当前位置:首页 > CSS

新闻列表制作css

2026-01-28 17:53:04CSS

新闻列表的CSS样式设计

新闻列表通常需要清晰、易读的布局,同时兼顾美观和响应式设计。以下是一些常见的CSS样式方案:

基础样式

新闻列表制作css

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 800px;
  margin: 0 auto;
}

.news-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
  transition: background-color 0.3s ease;
}

.news-item:hover {
  background-color: #f9f9f9;
}

.news-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.news-meta {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.news-summary {
  font-size: 15px;
  line-height: 1.5;
  color: #444;
}

卡片式布局

.news-card {
  display: flex;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.news-image {
  width: 200px;
  height: 150px;
  object-fit: cover;
}

.news-content {
  padding: 15px;
  flex: 1;
}

响应式设计

新闻列表制作css

@media (max-width: 768px) {
  .news-card {
    flex-direction: column;
  }

  .news-image {
    width: 100%;
    height: auto;
  }

  .news-title {
    font-size: 16px;
  }
}

时间线样式

.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ddd;
}

.news-item {
  position: relative;
  margin-bottom: 20px;
}

.news-item::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3498db;
}

悬停动画效果

.news-item {
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

这些样式可以根据实际需求进行组合和调整,创建出符合网站整体风格的新闻列表。关键是要保持内容清晰可读,同时通过适当的视觉层次引导用户浏览。

标签: 列表新闻
分享给朋友:

相关文章

vue实现商品列表

vue实现商品列表

Vue实现商品列表的方法 使用Vue实现商品列表需要结合数据绑定、组件化和状态管理。以下是实现商品列表的几种常见方法: 基础数据绑定实现 在Vue组件中定义商品数据数组,使用v-for指令循环渲染商…

vue实现列表分页

vue实现列表分页

Vue 列表分页实现方法 基础分页实现 安装依赖(如使用第三方库) npm install vue-paginate 模板部分示例 <template> <div>…

vue实现卡片列表

vue实现卡片列表

Vue 实现卡片列表 使用 v-for 动态渲染卡片列表 通过 Vue 的 v-for 指令可以动态渲染卡片列表,数据通常存储在组件的 data 或通过 API 获取。 <template&g…

vue实现列表点击

vue实现列表点击

Vue 实现列表点击的方法 在 Vue 中实现列表点击功能通常涉及 v-for 渲染列表和 v-on(或 @)绑定点击事件。以下是几种常见实现方式: 基础列表点击 使用 v-for 渲染列表,并通过…

vue实现多选列表

vue实现多选列表

Vue 实现多选列表的方法 使用 v-model 绑定数组 在 Vue 中,可以利用 v-model 指令绑定一个数组来实现多选功能。当用户选择多个选项时,选中的值会自动添加到数组中。 <te…

vue实现列表菜单

vue实现列表菜单

实现列表菜单的基本结构 在 Vue 中实现列表菜单通常使用 v-for 指令动态渲染菜单项。定义一个数组存储菜单数据,通过 v-for 遍历数组生成菜单项。 <template> &…