博客列表 >仿html.cn-移动页面-web前端第11章6.24

仿html.cn-移动页面-web前端第11章6.24

希望
希望原创
2020年07月02日 14:17:25552浏览

1.html.cn移动端页面分:头部,轮播图,导航,课程推荐栏,最新课程栏,文章栏,更多,底部

  • 如下图效果:
    html.cn移动端首页
  • index.html代码如下:

    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. <link rel="stylesheet" href="fonts/iconfont.css" />
    7. <link href="./css/common.css" type="text/css" rel="stylesheet" />
    8. <link href="./css/layui.css" type="text/css" rel="stylesheet" />
    9. <link href="./css/index.css" type="text/css" rel="stylesheet" />
    10. <title>仿html.cn中文网移动站首页</title>
    11. </head>
    12. <body>
    13. <!-- 页眉 -->
    14. <div class="topone" style="background: #fff; padding: 0 5px;">
    15. <li class="logo" style="width: 33%;">
    16. <a href="/">
    17. <img class="logoer" src="./images/1.png" width="100" height="30" />
    18. </a>
    19. </li>
    20. <li class="loginer" style="width: 40%; margin-left: 3%; padding-left: 0;">
    21. <input
    22. style="
    23. width: 100%;
    24. line-height: 30px;
    25. border-radius: 8px;
    26. border: 2px;
    27. background: #edeff0;
    28. text-align: center;
    29. "
    30. name="wd"
    31. id="search"
    32. type="text"
    33. value=""
    34. placeholder="搜索你需要的"
    35. />
    36. </li>
    37. <li class="rightuser" style="width: 20%;">
    38. <a href="/">
    39. <span
    40. class="iconfont"
    41. style="color: #999; margin-left: 14px; font-size: 20px;"
    42. >&#58882;</span
    43. >
    44. </a>
    45. <a href="/">
    46. <span
    47. class="iconfont"
    48. style="color: #999; margin-left: 14px; font-size: 20px;"
    49. >&#58883;</span
    50. >
    51. </a>
    52. </li>
    53. </div>
    54. <!-- 页眉结束-->
    55. <!-- 轮播图 -->
    56. <div class="slider">
    57. <img src="./images/b1.jpg" width: 300px; height="170px" alt="" />
    58. </div>
    59. <!-- 主导航 -->
    60. <nav>
    61. <div>
    62. <a herf=""><img src="./images/html.png"</a>
    63. <a href="">HTML</a>
    64. </div>
    65. <div>
    66. <a herf=""><img src="./images/code.png"</a>
    67. <a href="">CSS</a>
    68. </div>
    69. <div>
    70. <a herf=""><img src="./images/JavaScript.png"</a>
    71. <a href="">JS</a>
    72. </div>
    73. <div>
    74. <a herf=""><img src="./images/sql.png"</a>
    75. <a href="">JS框架</a>
    76. </div>
    77. <div>
    78. <a herf=""><img src="./images/html.png"</a>
    79. <a href="">前端开发</a>
    80. </div>
    81. <div>
    82. <a herf=""><img src="./images/code.png"</a>
    83. <a href="">移动开发</a>
    84. </div>
    85. <div>
    86. <a herf=""><img src="./images/JavaScript.png"</a>
    87. <a href="">开发工具</a>
    88. </div>
    89. <div>
    90. <a herf=""><img src="./images/sql.png"</a>
    91. <a href="">学习路径</a>
    92. </div>
    93. </nav>
    94. <!-- 导航结束 -->
    95. <!-- 中间部分 -->
    96. <h2>
    97. 推荐课程
    98. </h2>
    99. <!-- 课程 -->
    100. <div class="container">
    101. <a href=""><img src="./images/1.jpg" alt="" /></a>
    102. <a href=""><img src="./images/1.jpg" alt="" /></a>
    103. </div>
    104. <div class="box">
    105. <a href=""><img src="./images/2.jpg" alt="" /></a>
    106. <div class="desc">
    107. <a href="">Vue.js 开发基础教程</a>
    108. <p>
    109. <span class="level">收费</span>
    110. <span>6309次播放</span>
    111. </p>
    112. </div>
    113. </div>
    114. <br />
    115. <div class="box">
    116. <a href=""><img src="./images/2.jpg" alt="" /></a>
    117. <div class="desc">
    118. <a href="">Vue.js 开发基础教程</a>
    119. <p>
    120. <span class="level">收费</span>
    121. <span>6309次播放</span>
    122. </p>
    123. </div>
    124. </div>
    125. <h2>
    126. 最新课程
    127. </h2>
    128. <div class="box">
    129. <a href=""><img src="./images/3.jpg" alt="" /></a>
    130. <div class="desc">
    131. <a href="">Vue.js 开发基础教程</a>
    132. <p>
    133. <span class="level">收费</span>
    134. <span>6309次播放</span>
    135. </p>
    136. </div>
    137. </div>
    138. <br />
    139. <div class="box">
    140. <a href=""><img src="./images/3.jpg" alt="" /></a>
    141. <div class="desc">
    142. <a href="">Vue.js 开发基础教程</a>
    143. <p>
    144. <span class="level">收费</span>
    145. <span>6309次播放</span>
    146. </p>
    147. </div>
    148. </div>
    149. <div class="box">
    150. <a href=""><img src="./images/3.jpg" alt="" /></a>
    151. <div class="desc">
    152. <a href="">Vue.js 开发基础教程</a>
    153. <p>
    154. <span class="level">收费</span>
    155. <span>6309次播放</span>
    156. </p>
    157. </div>
    158. </div>
    159. <br />
    160. <div class="box">
    161. <a href=""><img src="./images/3.jpg" alt="" /></a>
    162. <div class="desc">
    163. <a href="">Vue.js 开发基础教程</a>
    164. <p>
    165. <span class="level">收费</span>
    166. <span>6309次播放</span>
    167. </p>
    168. </div>
    169. </div>
    170. <!-- 最新文章 -->
    171. <h2>
    172. 最新文章
    173. </h2>
    174. <div class="article">
    175. <div class="article-title">
    176. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    177. <br />
    178. <br />
    179. <span>发布时间:</span>
    180. <input type="date" name="birthday" />
    181. </div>
    182. <a href=""><img src="./images/4.jpg" alt="" /></a>
    183. </div>
    184. <br />
    185. <div class="article">
    186. <div class="article-title">
    187. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    188. <br />
    189. <br />
    190. <span>发布时间:</span>
    191. <input type="date" name="birthday" />
    192. </div>
    193. <a href=""><img src="./images/4.jpg" alt="" /></a>
    194. </div>
    195. <br />
    196. <div class="article">
    197. <div class="article-title">
    198. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    199. <br />
    200. <br />
    201. <span>发布时间:</span>
    202. <input type="date" name="birthday" />
    203. </div>
    204. <a href=""><img src="./images/4.jpg" alt="" /></a>
    205. </div>
    206. <br />
    207. <div class="article">
    208. <div class="article-title">
    209. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    210. <br />
    211. <br />
    212. <span>发布时间:</span>
    213. <input type="date" name="birthday" />
    214. </div>
    215. <a href=""><img src="./images/4.jpg" alt="" /></a>
    216. </div>
    217. <br />
    218. <div class="article">
    219. <div class="article-title">
    220. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    221. <br />
    222. <br />
    223. <span>发布时间:</span>
    224. <input type="date" name="birthday" />
    225. </div>
    226. <a href=""><img src="./images/4.jpg" alt="" /></a>
    227. </div>
    228. <br />
    229. <div class="article">
    230. <div class="article-title">
    231. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    232. <br />
    233. <br />
    234. <span>发布时间:</span>
    235. <input type="date" name="birthday" />
    236. </div>
    237. <a href=""><img src="./images/4.jpg" alt="" /></a>
    238. </div>
    239. <br />
    240. <div class="article">
    241. <div class="article-title">
    242. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    243. <br />
    244. <br />
    245. <span>发布时间:</span>
    246. <input type="date" name="birthday" />
    247. </div>
    248. <a href=""><img src="./images/4.jpg" alt="" /></a>
    249. </div>
    250. <br />
    251. <div class="article">
    252. <div class="article-title">
    253. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    254. <br />
    255. <br />
    256. <span>发布时间:</span>
    257. <input type="date" name="birthday" />
    258. </div>
    259. <a href=""><img src="./images/4.jpg" alt="" /></a>
    260. </div>
    261. <br />
    262. <div class="article">
    263. <div class="article-title">
    264. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    265. <br />
    266. <br />
    267. <span>发布时间:</span>
    268. <input type="date" name="birthday" />
    269. </div>
    270. <a href=""><img src="./images/4.jpg" alt="" /></a>
    271. </div>
    272. <br />
    273. <div class="article">
    274. <div class="article-title">
    275. <a href="">怎样用 Vue-Multiselect 库来改善下拉菜单的效果?</a>
    276. <br />
    277. <br />
    278. <span>发布时间:</span>
    279. <input type="date" name="birthday" />
    280. </div>
    281. <a href=""><img src="./images/4.jpg" alt="" /></a>
    282. </div>
    283. <br />
    284. <div class="more">
    285. <a href="">更多内容</a>
    286. </div>
    287. <br />
    288. <br />
    289. <br />
    290. <br />
    291. <!-- 页脚 -->
    292. <footer>
    293. <a href="">
    294. <span class="iconfont">&#58881;</span>
    295. <span>首页</span>
    296. </a>
    297. <a href="">
    298. <span class="iconfont">&#58955;</span>
    299. <span>课程</span>
    300. </a>
    301. <a href="">
    302. <span class="iconfont">&#59176;</span>
    303. <span>资源</span>
    304. </a>
    305. <a href="">
    306. <span class="iconfont">&#58903;</span>
    307. <span>路径</span>
    308. </a>
    309. <a href="">
    310. <span class="iconfont">&#58882;</span>
    311. <span>我的</span>
    312. </a>
    313. </footer>
    314. </body>
    315. </html>
  • index.css代码如下:

  1. * {
  2. padding: 0;
  3. margin: 0;
  4. box-sizing: border-box;
  5. }
  6. body {
  7. width: 100%;
  8. height: 100%;
  9. background-color: #f0f0f3;
  10. }
  11. a {
  12. text-decoration: none;
  13. }
  14. /*公共头部*/
  15. .topone {
  16. color: white;
  17. background-color: #333;
  18. height: 50px;
  19. display: flex;
  20. align-items: center;
  21. justify-content: space-between;
  22. position: fixed;
  23. width: 100vw;
  24. padding: 0 15px;
  25. }
  26. .topone li {
  27. line-height: 42px;
  28. float: left;
  29. }
  30. /*公共头部*/
  31. /* 轮播图 */
  32. body > .slider {
  33. height: 200px;
  34. }
  35. body > .slider > img {
  36. margin-top: 10px;
  37. width: 100%;
  38. height: 100%;
  39. }
  40. /* 导航区 */
  41. body > nav {
  42. height: 200px;
  43. margin-bottom: 10px;
  44. background: white;
  45. display: flex;
  46. /* 水平排列要换行 */
  47. flex-flow: row wrap;
  48. align-content: space-around;
  49. }
  50. body > nav > div {
  51. width: 25vw;
  52. display: flex;
  53. /* 图片加文字垂直又居中排 */
  54. flex-flow: column nowrap;
  55. align-items: center;
  56. }
  57. /* 导航区图片变小居中处理 */
  58. body > nav > div > a:first-of-type {
  59. text-align: center;
  60. }
  61. /* 图片缩小一半 */
  62. body > nav > div img {
  63. width: 50%;
  64. }
  65. /* 推荐课程 */
  66. h2 {
  67. margin-left: 10px;
  68. margin-top: 20px;
  69. padding: 10px;
  70. color: grey;
  71. }
  72. .container {
  73. display: flex;
  74. }
  75. .container img {
  76. width: 185px;
  77. height: 100px;
  78. padding: 5px;
  79. }
  80. .box {
  81. display: flex;
  82. margin: auto;
  83. width: 350px;
  84. padding: 10px;
  85. background-color: white;
  86. }
  87. .box img {
  88. width: 150px;
  89. height: 80px;
  90. }
  91. .box > .desc {
  92. width: 180px;
  93. padding: 10px;
  94. }
  95. .box > .desc p {
  96. font-size: 10px;
  97. margin-top: 10px;
  98. color: #666;
  99. }
  100. .level {
  101. color: white;
  102. padding: 3px;
  103. border-radius: 5px;
  104. background-color: #666;
  105. }
  106. .box a {
  107. margin-top: 5px;
  108. }
  109. /* 最新文章 */
  110. .article {
  111. width: 350px;
  112. font-size: 12px;
  113. padding: 10px;
  114. margin: auto;
  115. color: #666;
  116. background-color: white;
  117. display: flex;
  118. }
  119. .article > .article-title {
  120. width: 250px;
  121. margin-left: 5px;
  122. }
  123. .article a {
  124. font-size: 14px;
  125. color: #666;
  126. }
  127. .article img {
  128. width: 100px;
  129. height: 72px;
  130. }
  131. /* 更多 */
  132. .more {
  133. width: 350px;
  134. margin-left: 10px;
  135. padding: 10px;
  136. margin-top: 10px;
  137. display: flex;
  138. background-color: white;
  139. }
  140. .more a {
  141. margin: auto;
  142. color: #666;
  143. }
  144. /* 脚部 */
  145. body > footer {
  146. color: #666;
  147. background-color: #efefef;
  148. border-top: 1px solid #ccc;
  149. height: 55px;
  150. position: fixed;
  151. bottom: 0;
  152. width: 100vw;
  153. display: flex;
  154. justify-content: space-evenly;
  155. }
  156. body > footer a {
  157. margin-top: 10px;
  158. font-size: 0.8rem;
  159. display: flex;
  160. /* 垂直排列不换行 */
  161. flex-flow: column nowrap;
  162. /* 交叉轴项目居中显示 */
  163. align-items: center;
  164. }
  165. body > footer a > span:first-of-type {
  166. /* 图标字体应该大一些 */
  167. font-size: 1.6rem;
  168. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议