博客列表 >仿写m.php.cn首页

仿写m.php.cn首页

荔枝哥哥
荔枝哥哥原创
2020年01月01日 18:23:12879浏览

上代码,上图

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="demo1_2.css">
  8. <title>仿m.php.cn移动端首页</title>
  9. </head>
  10. <body>
  11. <header>
  12. <img src="static/images/user-pic.jpeg" alt="">
  13. <img src="static/images/logo.png" alt="">
  14. <img src="static/images/user-nav.jpg" alt="">
  15. </header>
  16. <main>
  17. <header><img src="static/images/banner.jpg" alt=""></header>
  18. <nav>
  19. <a href="">
  20. <img src="static/images/html.png" alt="">
  21. <span>Html/Css</span>
  22. </a>
  23. <a href="">
  24. <img src="static/images/JavaScript.png" alt="">
  25. <span>JavaScript</span>
  26. </a>
  27. <a href="">
  28. <img src="static/images/code.png" alt="">
  29. <span>服务器端</span>
  30. </a>
  31. <a href="">
  32. <img src="static/images/sql.png" alt="">
  33. <span>数据库</span>
  34. </a>
  35. </nav>
  36. <nav>
  37. <a href="">
  38. <img src="static/images/app.png" alt="">
  39. <span>移动端</span>
  40. </a>
  41. <a href="">
  42. <img src="static/images/manual.png" alt="">
  43. <span>手册</span>
  44. </a>
  45. <a href="">
  46. <img src="static/images/tool2.png" alt="">
  47. <span>工具</span>
  48. </a>
  49. <a href="">
  50. <img src="static/images/live.png" alt="">
  51. <span>直播</span>
  52. </a>
  53. </nav>
  54. <section>
  55. <h2>推荐课程</h2>
  56. <div>
  57. <section><a href=""><img src="static/images/tjkc1.jpg" alt=""></a></section>
  58. <section><a href=""><img src="static/images/tjkc2.jpg" alt=""></a></section>
  59. </div>
  60. <article>
  61. <section><a href=""><img src="static/images/tjkc3.jpg" alt=""></a></section>
  62. <section>
  63. <a href="">CI框架30分钟极速入门</a>
  64. <span><i>中级</i>55674</span>
  65. </section>
  66. </article>
  67. <article>
  68. <section><a href=""><img src="static/images/tjkc4.jpg" alt=""></a></section>
  69. <section>
  70. <a href="">2019前端入门_HTML5</a>
  71. <span><i>初级</i>257292</span>
  72. </section>
  73. </article>
  74. </section>
  75. </main>
  76. <footer>
  77. <img src="static/font-icon/geren.png" alt="">
  78. <img src="static/font-icon/luntan.png" alt="">
  79. <img src="static/font-icon/video.png" alt="">
  80. <img src="static/font-icon/zhuye.png" alt="">
  81. </footer>
  82. </body>
  83. </html>
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. /* outline: 1px dashed; */
  5. }
  6. body {
  7. display: flex;
  8. flex-direction: column;
  9. height: 100vh;
  10. width: 100vw;
  11. background-color: #edeff0;
  12. }
  1. @import url('demo1_1.css');
  2. /*头部样式*/
  3. body > header {
  4. /*转为Flex*/
  5. display: flex;
  6. flex-direction: row;
  7. justify-content: space-between;
  8. align-items: center;
  9. }
  10. body > header > img:first-of-type,
  11. body > header > img:last-of-type {
  12. height: 26px;
  13. margin: 10px;
  14. }
  15. body > header > img:nth-of-type(2){
  16. height: 40px;
  17. }
  18. body > header > img:first-of-type {
  19. border-radius: 50%;
  20. }
  21. body > header {
  22. background-color: #22282d;
  23. }
  24. body > footer {
  25. background-color: #eaeaea;
  26. }
  27. body > main {
  28. flex-grow: 1;
  29. overflow: auto;
  30. display: flex;
  31. flex-direction: column;
  32. }
  33. /*轮播*/
  34. body > main > header > img {
  35. width: 100vw;
  36. }
  37. /*导航区*/
  38. body > main > nav {
  39. background-color: lightsteelblue;
  40. display: flex;
  41. flex-flow: row wrap;
  42. justify-content: space-between;
  43. align-content:space-between;
  44. }
  45. body > main > nav > a {
  46. display: flex;
  47. flex-flow: column wrap;
  48. align-content: center;
  49. text-align: center;
  50. margin: 5px;
  51. text-decoration: none;
  52. }
  53. body > main > nav > a > img {
  54. width: 9vh;
  55. margin: 2px;
  56. }
  57. /*主体内容区*/
  58. body > main > section {
  59. display: flex;
  60. flex-direction: column;
  61. }
  62. /*内容区的标题*/
  63. body > main > section > h2 {
  64. padding: 2vh;
  65. }
  66. /*内容区的图文列表详情*/
  67. body > main > section > article {
  68. display: flex;
  69. flex-direction: row;
  70. margin: 1vh 0;
  71. }
  72. body > main > section > div {
  73. display: flex;
  74. flex-direction: row;
  75. margin: 1vh 0;
  76. justify-content: center;
  77. }
  78. /* 2张图片对齐显示 */
  79. body > main > section > div > section {
  80. display: flex;
  81. flex-direction: column;
  82. }
  83. body > main > section > div > section > a >img {
  84. width: 50vw;
  85. }
  86. /* 内容区域图文列表详情 */
  87. body > main > section > article {
  88. display: flex;
  89. flex-direction: row;
  90. margin: 1vh 0;
  91. background-color: #fff;
  92. }
  93. body > main > section > article > section{
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: space-around;
  97. flex:1;
  98. margin-left: 1vw;
  99. }
  100. body > main > section > article > section > a{
  101. margin: 1vh 1vw;
  102. }
  103. body > main > section > article > section > a > img {
  104. height: 15vh;
  105. }
  106. body > main > section > article > section > span > i {
  107. background: #595757;
  108. border-radius: 8px;
  109. color: #fff;
  110. font-size: 10px;
  111. padding: 3px;
  112. }
  113. /* 底部菜单栏 */
  114. body > footer {
  115. width: 100vw;
  116. display: flex;
  117. flex-direction: row;
  118. justify-content: space-around;
  119. }
  120. body > footer > img {
  121. height: 26px;
  122. margin: 10px;
  123. }

m.php.cn

总结

思路是先画再写,然后,碰到导航区域,在不同的显示屏幕下,他对齐不了,然后想办法套了2层盒子,不管是什么大小的屏幕都可以自适应了。

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