22301008 | af17315 | 2025-06-15 10:46:25 +0800 | [diff] [blame] | 1 | /* --------- 容器 & Tabs --------- */ |
| 2 | .home-feed { |
| 3 | padding: 20px; |
| 4 | } |
| 5 | |
| 6 | .feed-tabs { |
| 7 | display: flex; |
| 8 | flex-wrap: wrap; |
| 9 | gap: 12px; |
| 10 | margin-bottom: 20px; |
| 11 | } |
| 12 | |
| 13 | .feed-tabs .tab { |
| 14 | padding: 6px 12px; |
| 15 | border: none; |
| 16 | background: #f0f0f0; |
| 17 | border-radius: 16px; |
| 18 | cursor: pointer; |
| 19 | transition: background 0.2s; |
| 20 | } |
| 21 | |
| 22 | .feed-tabs .tab.active { |
| 23 | background: #ff4757; |
| 24 | color: #fff; |
| 25 | } |
| 26 | |
| 27 | /* --------- 瀑布流布局 --------- */ |
| 28 | .feed-grid { |
| 29 | display: grid; |
| 30 | grid-gap: 16px; |
| 31 | grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); |
| 32 | } |
| 33 | |
| 34 | /* --------- 卡片样式及最大高度限制 --------- */ |
| 35 | .feed-card { |
| 36 | display: flex; |
| 37 | flex-direction: column; |
| 38 | max-height: 360px; /* 卡片最大高度 */ |
| 39 | overflow: hidden; /* 超出部分隐藏 */ |
| 40 | background: #fff; |
| 41 | border-radius: 8px; |
| 42 | box-shadow: 0 1px 4px rgba(0,0,0,0.1); |
22301008 | d5fbb78 | 2025-06-18 16:28:43 +0800 | [diff] [blame] | 43 | transition: transform 0.2s, box-shadow 0.2s; |
| 44 | cursor: pointer; /* 添加手型指针 */ |
22301008 | af17315 | 2025-06-15 10:46:25 +0800 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | .feed-card:hover { |
| 48 | transform: translateY(-4px); |
22301008 | d5fbb78 | 2025-06-18 16:28:43 +0800 | [diff] [blame] | 49 | box-shadow: 0 4px 12px rgba(0,0,0,0.15); |
22301008 | af17315 | 2025-06-15 10:46:25 +0800 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | /* 封面图固定高度 */ |
| 53 | .card-img { |
| 54 | width: 100%; |
| 55 | height: 180px; /* 固定图片区域高度 */ |
| 56 | object-fit: cover; |
| 57 | flex-shrink: 0; /* 不随容器收缩 */ |
| 58 | } |
| 59 | |
| 60 | /* 标题填充剩余空间 */ |
| 61 | .card-title { |
| 62 | font-size: 14px; |
| 63 | color: #333; |
| 64 | margin: 12px; |
| 65 | line-height: 1.4; |
| 66 | flex: 1; /* 占满中间区域 */ |
| 67 | overflow: hidden; |
| 68 | text-overflow: ellipsis; |
| 69 | display: -webkit-box; |
| 70 | -webkit-line-clamp: 2; /* 最多两行 */ |
| 71 | -webkit-box-orient: vertical; |
| 72 | } |
| 73 | |
| 74 | /* --------- 底部:作者 + 点赞 --------- */ |
| 75 | .card-footer { |
| 76 | display: flex; |
| 77 | justify-content: space-between; |
| 78 | align-items: center; |
| 79 | padding: 8px 12px; |
| 80 | border-top: 1px solid #f0f0f0; |
| 81 | background: #fff; |
| 82 | flex-shrink: 0; /* 保持在底部 */ |
| 83 | } |
| 84 | |
| 85 | /* 作者区域 */ |
| 86 | .card-author { |
| 87 | display: flex; |
| 88 | align-items: center; |
| 89 | gap: 8px; |
| 90 | } |
| 91 | |
| 92 | .card-author .avatar { |
| 93 | width: 24px; |
| 94 | height: 24px; |
| 95 | border-radius: 50%; |
| 96 | object-fit: cover; |
| 97 | } |
| 98 | |
| 99 | .card-author .username { |
| 100 | font-size: 13px; |
| 101 | color: #333; |
| 102 | } |
| 103 | |
| 104 | /* 点赞区域 */ |
| 105 | .card-likes { |
| 106 | display: flex; |
| 107 | align-items: center; |
| 108 | gap: 4px; |
| 109 | } |
| 110 | |
| 111 | .card-likes svg { |
| 112 | color: #ff4757; |
| 113 | } |
| 114 | |
| 115 | .card-likes .likes-count { |
| 116 | font-size: 13px; |
| 117 | color: #666; |
| 118 | } |
| 119 | |
| 120 | /* 搜索框美化 */ |
| 121 | .feed-search { |
| 122 | display: flex; |
| 123 | gap: 8px; |
| 124 | align-items: center; |
| 125 | } |
| 126 | .search-input { |
| 127 | flex: 1; |
| 128 | padding: 8px 14px; |
| 129 | border: 1.5px solid #e0e0e0; |
| 130 | border-radius: 20px; |
| 131 | font-size: 15px; |
| 132 | outline: none; |
| 133 | transition: border 0.2s; |
| 134 | background: #fafbfc; |
| 135 | } |
| 136 | .search-input:focus { |
| 137 | border: 1.5px solid #e84c4a; |
| 138 | background: #fff; |
| 139 | } |
| 140 | .search-btn { |
| 141 | padding: 8px 22px; |
| 142 | border: none; |
| 143 | border-radius: 20px; |
| 144 | background: linear-gradient(90deg,#ff6a6a,#ff4757); |
| 145 | color: #fff; |
| 146 | font-weight: 600; |
| 147 | font-size: 15px; |
| 148 | cursor: pointer; |
| 149 | box-shadow: 0 2px 8px rgba(255,71,87,0.08); |
| 150 | transition: background 0.2s, box-shadow 0.2s; |
| 151 | } |
| 152 | .search-btn:hover { |
| 153 | background: linear-gradient(90deg,#ff4757,#e84c4a); |
| 154 | box-shadow: 0 4px 16px rgba(255,71,87,0.15); |
| 155 | } |