博客列表 >仿今日头条首页

仿今日头条首页

至亲难忘
至亲难忘原创
2023年03月25日 18:25:53339浏览
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <link rel="stylesheet" href="static/css/index.css">
  9. <link rel="stylesheet" href="static/font_icon/iconfont.css">
  10. </head>
  11. <body>
  12. <div class="header">
  13. <!-- 搜索框 -->
  14. <div class="search">
  15. <div class="keys">
  16. <span class="iconfont icon-fangdajing"></span>
  17. <span>习近平主席访问俄罗斯</span>
  18. </div>
  19. <!-- 发布按钮 -->
  20. <div class="publish">
  21. <span class="iconfont icon-jiahao"></span>
  22. <span>发布</span>
  23. </div>
  24. </div>
  25. <!-- 导航条 -->
  26. <div class="navs">
  27. <a href="" class="active">推荐</a>
  28. <a href="">科技</a>
  29. <a href="">军事</a>
  30. <a href="">两性</a>
  31. <a href="">明星</a>
  32. </div>
  33. </div>
  34. <!-- 主体 -->
  35. <div class="main">
  36. <div class="rec-list">
  37. <a href="" class="item">
  38. <span class="title">习近平主席访俄第一天,这些信息值得关注</span>
  39. <div class="desc">
  40. <span class="tag">置顶</span>
  41. <div class="other">
  42. <span>已关注</span>
  43. <span>澎湃新闻</span>
  44. <span>122条评论</span>
  45. </div>
  46. </div>
  47. </a>
  48. <a href="" class="item">
  49. <span class="title">习近平主席访俄第一天,这些信息值得关注</span>
  50. <div class="desc">
  51. <span class="tag">置顶</span>
  52. <div class="other">
  53. <span>已关注</span>
  54. <span>澎湃新闻</span>
  55. <span>122条评论</span>
  56. </div>
  57. </div>
  58. </a>
  59. <a href="" class="item">
  60. <span class="title">习近平主席访俄第一天,这些信息值得关注</span>
  61. <div class="desc">
  62. <span class="tag">置顶</span>
  63. <div class="other">
  64. <span>已关注</span>
  65. <span>澎湃新闻</span>
  66. <span>122条评论</span>
  67. </div>
  68. </div>
  69. </a>
  70. <a href="" class="item">
  71. <span class="title">习近平主席访俄第一天,这些信息值得关注</span>
  72. <div class="desc">
  73. <span class="tag">置顶</span>
  74. <div class="other">
  75. <span>已关注</span>
  76. <span>澎湃新闻</span>
  77. <span>122条评论</span>
  78. </div>
  79. </div>
  80. </a>
  81. </div>
  82. <!-- 左文本+右图片 -->
  83. <div class="img1-list">
  84. <a href="" class="item">
  85. <!-- 文本 -->
  86. <div class="left">
  87. <div class="title">还派什么大使,美图晾了我们14个月,是时候反击了</div>
  88. <div class="desc">
  89. <span class="author">魂淡君</span>
  90. <span class="replay-num">98条评价</span>
  91. <span class="time">1小时前</span>
  92. </div>
  93. </div>
  94. <!-- 图片 -->
  95. <img src="static/images/1.jpeg" class="right">
  96. </a>
  97. <a href="" class="item">
  98. <!-- 文本 -->
  99. <div class="left">
  100. <div class="title">还派什么大使,美图晾了我们14个月,是时候反击了</div>
  101. <div class="desc">
  102. <span class="author">魂淡君</span>
  103. <span class="replay-num">98条评价</span>
  104. <span class="time">1小时前</span>
  105. </div>
  106. </div>
  107. <!-- 图片 -->
  108. <img src="static/images/1.jpeg" class="right">
  109. </a>
  110. <a href="" class="item">
  111. <!-- 文本 -->
  112. <div class="left">
  113. <div class="title">还派什么大使,美图晾了我们14个月,是时候反击了</div>
  114. <div class="desc">
  115. <span class="author">魂淡君</span>
  116. <span class="replay-num">98条评价</span>
  117. <span class="time">1小时前</span>
  118. </div>
  119. </div>
  120. <!-- 图片 -->
  121. <img src="static/images/1.jpeg" class="right">
  122. </a>
  123. <a href="" class="item">
  124. <!-- 文本 -->
  125. <div class="left">
  126. <div class="title">还派什么大使,美图晾了我们14个月,是时候反击了</div>
  127. <div class="desc">
  128. <span class="author">魂淡君</span>
  129. <span class="replay-num">98条评价</span>
  130. <span class="time">1小时前</span>
  131. </div>
  132. </div>
  133. <!-- 图片 -->
  134. <img src="static/images/1.jpeg" class="right">
  135. </a>
  136. <a href="" class="item">
  137. <!-- 文本 -->
  138. <div class="left">
  139. <div class="title">还派什么大使,美图晾了我们14个月,是时候反击了</div>
  140. <div class="desc">
  141. <span class="author">魂淡君</span>
  142. <span class="replay-num">98条评价</span>
  143. <span class="time">1小时前</span>
  144. </div>
  145. </div>
  146. <!-- 图片 -->
  147. <img src="static/images/1.jpeg" class="right">
  148. </a>
  149. </div>
  150. <div class="img2-list">
  151. <a href="" class="item">
  152. <div class="title">2001年金吉奇用承诺诱捕米洛舍维奇</div>
  153. <div class="imgs">
  154. <img src="static/images/2.jpeg">
  155. <img src="static/images/2.jpeg">
  156. <img src="static/images/2.jpeg">
  157. </div>
  158. </a>
  159. <a href="" class="item">
  160. <div class="title">2001年金吉奇用承诺诱捕米洛舍维奇</div>
  161. <div class="imgs">
  162. <img src="static/images/2.jpeg">
  163. <img src="static/images/2.jpeg">
  164. <img src="static/images/2.jpeg">
  165. </div>
  166. </a>
  167. <a href="" class="item">
  168. <div class="title">2001年金吉奇用承诺诱捕米洛舍维奇</div>
  169. <div class="imgs">
  170. <img src="static/images/2.jpeg">
  171. <img src="static/images/2.jpeg">
  172. <img src="static/images/2.jpeg">
  173. </div>
  174. </a>
  175. <a href="" class="item">
  176. <div class="title">2001年金吉奇用承诺诱捕米洛舍维奇</div>
  177. <div class="imgs">
  178. <img src="static/images/2.jpeg">
  179. <img src="static/images/2.jpeg">
  180. <img src="static/images/2.jpeg">
  181. </div>
  182. </a>
  183. </div>
  184. <!-- 上面文本,下面视频 -->
  185. <div class="video-list">
  186. <a href="" class="item">
  187. <div class="title">一生必须要去的5个地方,不要等老了才想来了,就太迟了,带上爱人现在出发</div>
  188. <video src="static/images/v1.mp4" controls></video>
  189. </a>
  190. <a href="" class="item">
  191. <div class="title">一生必须要去的5个地方,不要等老了才想来了,就太迟了,带上爱人现在出发</div>
  192. <video src="static/images/v1.mp4" controls></video>
  193. </a>
  194. <a href="" class="item">
  195. <div class="title">一生必须要去的5个地方,不要等老了才想来了,就太迟了,带上爱人现在出发</div>
  196. <video src="static/images/v1.mp4" controls></video>
  197. </a>
  198. <a href="" class="item">
  199. <div class="title">一生必须要去的5个地方,不要等老了才想来了,就太迟了,带上爱人现在出发</div>
  200. <video src="static/images/v1.mp4" controls></video>
  201. </a>
  202. </div>
  203. </div>
  204. <!-- 页脚部分 -->
  205. <div class="footer">
  206. <a href="" class="active">
  207. <span class="iconfont icon-shouye"></span>
  208. <span>首页</span>
  209. </a>
  210. <a href="" class="active">
  211. <span class="iconfont icon-24gl-play"></span>
  212. <span>视频</span>
  213. </a>
  214. <a href="" class="active">
  215. <span class="iconfont icon-yonghuguanli_huaban"></span>
  216. <span>图片</span>
  217. </a>
  218. <a href="" class="active">
  219. <span class="iconfont icon-yonghu"></span>
  220. <span>我的</span>
  221. </a>
  222. </div>
  223. </body>
  224. </html>
  225. css部分
  226. /* 通用设置 */
  227. * {
  228. margin: 0;
  229. padding: 0;
  230. box-sizing: border-box;
  231. }
  232. a {
  233. text-decoration: none;
  234. color: #555;
  235. }
  236. html{
  237. font-size: calc(100vw / 3.75);
  238. }
  239. body{
  240. font-size: 0.16rem;
  241. color: #333;
  242. background-color: #fff;
  243. margin: 0 auto;
  244. padding: 0 0.15rem;
  245. }
  246. body img,
  247. body video{
  248. width: 100%;
  249. }
  250. @media (max-width:320px) {
  251. html{
  252. font-size: 85px;
  253. }
  254. }
  255. @media (min-width:640px) {
  256. html{
  257. font-size: 170px;
  258. }
  259. }
  260. /* 头部 */
  261. .header {
  262. /* 使用固定定位 */
  263. position: fixed;
  264. left: 0;
  265. top: 0;
  266. right: 0;
  267. border-bottom: 1px solid #ccc;
  268. /* 确保永远在前面 */
  269. z-index: 9999;
  270. background-color: #fff;
  271. }
  272. /* 搜索框 */
  273. .header .search{
  274. background-color: red;
  275. padding: 0.08rem 0.15rem;
  276. /* 左面是输入框,右面是发布按钮,使用grid */
  277. display: grid;
  278. grid-template-columns: 1fr 0.5rem;
  279. }
  280. /* 关键字 */
  281. .header .search .keys{
  282. background-color: #fff;
  283. border-radius: 1.5rem;
  284. display: flex;
  285. place-items: center;
  286. padding-left: 0.1rem;
  287. }
  288. /* 发布按钮 */
  289. .header .publish{
  290. color: white;
  291. display: grid;
  292. place-items: center;
  293. }
  294. /* 导航条 */
  295. .header .navs{
  296. display: flex;
  297. place-content: space-around;
  298. /* padding: 0.1rem 0 0.5rem; */
  299. }
  300. /* 首个选中 */
  301. .header .navs a.active{
  302. color: red;
  303. }
  304. /* 选中后下方红条 */
  305. .header .navs a{
  306. position: relative;
  307. }
  308. .header .navs a.active::after{
  309. content: '';
  310. position: absolute;
  311. left: 0;
  312. width: 0.3rem;
  313. height: 0.03rem;
  314. bottom: -0.04rem;
  315. background-color: red;
  316. }
  317. /* **********主体部分 ********************/
  318. .main{
  319. min-height: 2000px;
  320. position: relative;
  321. top: 0.8rem;
  322. padding-bottom: 0.6rem;
  323. }
  324. /* 文本和标签 */
  325. .main .rec-list .item{
  326. display: block;
  327. margin-top: 0.1rem;
  328. }
  329. .main .rec-list .item .desc{
  330. display: flex;
  331. font-size: xx-small;
  332. gap: 0.1rem;
  333. }
  334. /* 标签 */
  335. .main .rec-list .item .desc .tag{
  336. color: red;
  337. }
  338. .main .rec-list .item .desc .other{
  339. color: #ccc;
  340. }
  341. /* 左文本和右图片 */
  342. .main .img1-list .item{
  343. margin-top: 0.1rem;
  344. display: grid;
  345. grid-template-columns: 1fr 1.3rem;
  346. gap: 0.2rem;
  347. }
  348. .main .img1-list .item .left{
  349. display: grid;
  350. place-content: space-between;
  351. }
  352. .main .img1-list .item .left .desc{
  353. font-size: xx-small;
  354. color: #ccc;
  355. }
  356. /* 上面文本和下面图片 */
  357. .main .img2-list .item{
  358. display: block;
  359. margin-top: 0.1rem;
  360. }
  361. .main .img2-list .item .imgs{
  362. display: grid;
  363. grid-template-columns: repeat(3,1fr);
  364. gap: 0.05rem;
  365. }
  366. /* 视频部分 */
  367. .main .video-list .item{
  368. display: block;
  369. margin-top: 0.1rem;
  370. }
  371. /***************** 底部 ****************/
  372. .footer{
  373. position: fixed;
  374. left: 0;
  375. right: 0;
  376. bottom: 0;
  377. background-color: #efefef;
  378. display: flex;
  379. place-content: space-around;
  380. }
  381. .footer a{
  382. display: grid;
  383. place-items: center;
  384. font-size: x-small;
  385. }
  386. .footer a .iconfont{
  387. font-size: xx-small;
  388. }
  389. /* 首个选中 */
  390. .footer a .active{
  391. color: red;
  392. }

效果图

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议