博客列表 >1227-移动端

1227-移动端


原创
2020年01月01日 01:21:49609浏览

HTML

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. <title>移动端首</title>
  8. <link rel="stylesheet" href="demo1.css">
  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. <div class="Carousel">
  17. <img src="static/images/banner.jpg" alt="">
  18. </div>
  19. <!--导航区-->
  20. <nav>
  21. <ul>
  22. <li>
  23. <a href="">
  24. <img src="static/images/html.png" alt="">
  25. <span>HTML/CSS</span>
  26. </a>
  27. </li>
  28. <li>
  29. <a href="">
  30. <img src="static/images/JavaScript.png" alt="">
  31. <span>JavaScipt</span>
  32. </a>
  33. </li>
  34. <li>
  35. <a href="">
  36. <img src="static/images/code.png" alt="">
  37. <span>服务器端</span>
  38. </a>
  39. </li>
  40. <li>
  41. <a href="">
  42. <img src="static/images/sql.png" alt="">
  43. <span>数据库</span>
  44. </a>
  45. </li>
  46. </ul>
  47. <ul>
  48. <li>
  49. <a href="">
  50. <img src="static/images/app.png" alt="">
  51. <span>移动端</span>
  52. </a>
  53. </li>
  54. <li>
  55. <a href="">
  56. <img src="static/images/manual.png" alt="">
  57. <span>手册</span>
  58. </a>
  59. </li>
  60. <li>
  61. <a href=""><img src="static/images/tool2.png" alt="">
  62. <span>工具</span>
  63. </a>
  64. </li>
  65. <li>
  66. <a href="">
  67. <img src="static/images/live.png" alt="">
  68. <span>直播</span>
  69. </a>
  70. </li>
  71. </ul>
  72. </nav>
  73. <!--课程-->
  74. <main>
  75. <article class="course">
  76. <h3>推荐课程</h3>
  77. <section>
  78. <a href=""><img src="static/images/tjkc1.jpg" alt=""></a>
  79. <a href=""><img src="static/images/tjkc2.jpg" alt=""></a>
  80. </section>
  81. <section>
  82. <div>
  83. <a href=""><img src="static/images/tjkc3.jpg" alt=""></a>
  84. <span>
  85. <a href="">一个推荐课程</a>
  86. <span><i>高级</i>888888</span>
  87. </span>
  88. </div>
  89. <div>
  90. <a href=""><img src="static/images/tjkc4.jpg" alt=""></a>
  91. <span>
  92. <a href="">一个推荐课程</a>
  93. <span><i>初级</i>99999</span>
  94. </span>
  95. </div>
  96. </section>
  97. </article>
  98. </main>
  99. <footer>
  100. <img src="static/font-icon/geren.png" alt="">
  101. <img src="static/font-icon/luntan.png" alt="">
  102. <img src="static/font-icon/video.png" alt="">
  103. <img src="static/font-icon/zhuye.png" alt="">
  104. </footer>
  105. </body>
  106. </html>

CSS

  1. img {
  2. width: 100%;
  3. }
  4. ul, li {
  5. margin: 0;
  6. padding: 0;
  7. }
  8. li {
  9. list-style: none;
  10. }
  11. a {
  12. text-decoration: none;
  13. color: gray;
  14. }
  15. /*头部*/
  16. header {
  17. position: fixed;
  18. top:0;
  19. width: 768px;
  20. height: 42px;
  21. background-color: #444444;
  22. display: flex;
  23. justify-content: space-between;
  24. }
  25. header > img:first-of-type,
  26. header > img:last-of-type {
  27. width: 26px;
  28. height: 26px;
  29. margin: 5px;
  30. }
  31. header > img:first-of-type {
  32. border-radius: 50%;
  33. }
  34. header > img {
  35. width: 94px;
  36. }
  37. /*轮播图*/
  38. .Carousel {
  39. display: flex;
  40. height: 200px;
  41. }
  42. /*导航*/
  43. nav {
  44. background-color: #fff;
  45. display: flex;
  46. flex-flow: column nowrap;
  47. }
  48. nav img {
  49. width: 45px;
  50. height: 49px;
  51. }
  52. nav > ul {
  53. display: flex;
  54. }
  55. nav ul li {
  56. flex: 1;
  57. }
  58. nav ul li a {
  59. display: flex;
  60. flex-flow: column wrap;
  61. align-items: center;
  62. margin: 10px;
  63. }
  64. nav ul li a span {
  65. margin-top: 5px;
  66. }
  67. main {
  68. display: flex;
  69. flex-direction: column;
  70. }
  71. main > .course > section:first-of-type {
  72. display: flex;
  73. }
  74. main > .course > section:first-of-type > a {
  75. margin: 5px;
  76. flex: 1;
  77. }
  78. main > .course > section:first-of-type > a > img {
  79. height: 90px;
  80. }
  81. /*课程*/
  82. main > .course > section:last-of-type {
  83. display: flex;
  84. flex-direction: column;
  85. }
  86. main > .course > section:last-of-type > div {
  87. background-color: #fff;
  88. margin: 5px;
  89. display: flex;
  90. }
  91. main > .course > section:last-of-type > div img {
  92. width: 350px;
  93. height: 90px;
  94. }
  95. main > .course > section:last-of-type > div > span {
  96. flex: 1;
  97. display: flex;
  98. flex-direction: column;
  99. margin-top: 5px;
  100. padding-left: 10px;
  101. }
  102. main > .course > section:last-of-type > div > span i {
  103. font-style: normal;
  104. background-color: #333333;
  105. color: white;
  106. border-radius: 3px;
  107. padding: 0 5px;
  108. font-size: smaller;
  109. }
  110. main > .course > section:last-of-type > div > span > span {
  111. margin-top: 40px;
  112. display: flex;
  113. justify-content: space-between;
  114. }
  115. footer {
  116. position: fixed;
  117. bottom:0;
  118. width: 100%;
  119. height: 24px;
  120. display: flex;
  121. flex-direction: row;
  122. justify-content: space-between;
  123. align-items: center;
  124. background-color: #edeff0;
  125. }
  126. footer > img {
  127. width: 26px;
  128. height: 26px;
  129. margin: 5px;
  130. }

效果图

总结

移动端和电脑端一样,也是搭积木搬一点一点拼起来,只是需要对可视范围左调整

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