博客列表 >移动端网站(前端页面)

移动端网站(前端页面)

可乐
可乐原创
2021年10月03日 18:35:30575浏览

HTML

  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>移动端网站首页</title>
  8. <link rel="stylesheet" href="index.css" />
  9. <script src="iconfont.js"></script>
  10. </head>
  11. <div>
  12. <!--菜单栏-->
  13. <div class="home-a">
  14. <div class="header-a">
  15. <li>
  16. <a href="">
  17. <svg class="icon" aria-hidden="true">
  18. <use xlink:href="#icon-didiandingwei"></use>
  19. </svg> </a>地址
  20. </li>
  21. <svg class="icon" aria-hidden="true">
  22. <use xlink:href="#icon-mianbao"></use>
  23. </svg>
  24. <a href="">登录用户</a>
  25. </div>
  26. <div class="search">
  27. <a href="">
  28. <svg class="icon" aria-hidden="true">
  29. <use xlink:href="#icon-sousuo"></use>
  30. </svg>
  31. <form action="">
  32. <input type="search" name="search" value="荞麦面包" />
  33. </form>
  34. </a>
  35. </div>
  36. </div>
  37. <div class="main">
  38. <!--导航-->
  39. <div class="navs">
  40. <a href="" class="icon-a">
  41. <img src="nav/jingxuanshipin.png" alt="" class="icon-b" />
  42. <div class="txt">精选</div>
  43. </a>
  44. <a href="" class="icon-a">
  45. <img src="nav/mianbao.png" alt="" class="icon-b" />
  46. <div class="txt">面包</div>
  47. </a>
  48. <a href="" class="icon-a">
  49. <img src="nav/tianpin.png" alt="" class="icon-b" />
  50. <div class="txt">甜品</div>
  51. </a>
  52. <a href="" class="icon-a">
  53. <img src="nav/guozhi.png" alt="" class="icon-b" />
  54. <div class="txt">果汁</div>
  55. </a>
  56. <a href="" class="icon-a">
  57. <img src="nav/wuliu.png" alt="" class="icon-b" />
  58. <div class="txt">物流</div>
  59. </a>
  60. <a href="" class="icon-a">
  61. <img src="nav/lipinka.png" alt="" class="icon-b" />
  62. <div class="txt">礼品卡</div>
  63. </a>
  64. </div>
  65. </div>
  66. <!--轮播图-->
  67. <div class="picture">
  68. <div class="imglist">
  69. <a href="" class="active"><img src="banner/mianbao.jpg" alt="" /></a>
  70. <a href=""><img src="banner/mianbao.jpg" alt="" /></a>
  71. <a href=""><img src="banner/mianbao.jpg" alt="" /></a>
  72. <div class="button">
  73. <span class="item active"></span>
  74. <span class="item"></span>
  75. <span class="item"></span>
  76. </div>
  77. </div>
  78. <!--产品区-->
  79. <div class="list-container">
  80. <div class="title-ctnr">
  81. <h5>甜品</h5>
  82. <small>推荐</small>
  83. </div>
  84. <ul class="block-ctnr">
  85. <li>
  86. <div class="cover-wrap">
  87. <img src="product/cake.PNG" alt="">
  88. </div>
  89. <div class="cover-cont">
  90. <div class="mov-detail">巧克力甜品</div>
  91. <div class="mov-info">
  92. <div>
  93. <i class="iconfont">&#xe8e3;</i>
  94. <span>产品价格</span>
  95. </div>
  96. <li>
  97. <div class="cover-wrap">
  98. <img src="product/cake.PNG" alt="">
  99. </div>
  100. <div class="cover-cont">
  101. <div class="mov-detail">巧克力甜品</div>
  102. <div class="mov-info">
  103. <div>
  104. <i class="iconfont">&#xe8e3;</i>
  105. <span>产品价格</span>
  106. </div>
  107. <li>
  108. <div class="cover-wrap">
  109. <img src="product/cake.PNG" alt="">
  110. </div>
  111. <div class="cover-cont">
  112. <div class="mov-detail">巧克力甜品</div>
  113. <div class="mov-info">
  114. <div>
  115. <i class="iconfont">&#xe8e3;</i>
  116. <span>产品价格</span>
  117. </div>
  118. <li>
  119. <div class="cover-wrap">
  120. <img src="product/cake.PNG" alt="">
  121. </div>
  122. <div class="cover-cont">
  123. <div class="mov-detail">巧克力甜品</div>
  124. <div class="mov-info">
  125. <div>
  126. <i class="iconfont">&#xe8e3;</i>
  127. <span>产品价格</span>
  128. </div>
  129. <li>
  130. <div class="cover-wrap">
  131. <img src="product/cake.PNG" alt="">
  132. </div>
  133. <div class="cover-cont">
  134. <div class="mov-detail">巧克力甜品</div>
  135. <div class="mov-info">
  136. <div>
  137. <i class="iconfont">&#xe8e3;</i>
  138. <span>产品价格</span>
  139. </div>
  140. <li>
  141. <div class="cover-wrap">
  142. <img src="product/cake.PNG" alt="">
  143. </div>
  144. <div class="cover-cont">
  145. <div class="mov-detail">巧克力甜品</div>
  146. <div class="mov-info">
  147. <div>
  148. <i class="iconfont">&#xe8e3;</i>
  149. <span>产品价格</span>
  150. </div>
  151. </div>
  152. </div>
  153. </li>
  154. </ul>
  155. </div>
  156. <!-- footer-->
  157. <div class="footer">
  158. <li>
  159. <a href="">
  160. <svg class="icon" aria-hidden="true">
  161. <use xlink:href="#icon-shouyeshouye"></use>
  162. </svg> </a>首页
  163. </li>
  164. <li>
  165. <a href="">
  166. <svg class="icon" aria-hidden="true">
  167. <use xlink:href="#icon-chanpin"></use>
  168. </svg> </a>产品
  169. </li>
  170. <li>
  171. <a href="">
  172. <svg class="icon" aria-hidden="true">
  173. <use xlink:href="#icon-gouwuche"></use>
  174. </svg> </a>购物车
  175. </li>
  176. <li>
  177. <a href="">
  178. <svg class="icon" aria-hidden="true">
  179. <use xlink:href="#icon-wode"></use>
  180. </svg> </a>我的
  181. </li>
  182. </div>
  183. </div>
  184. </body>
  185. </html>

CSS

  1. @import url(shangpin/iconfont.css);
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. a {
  8. text-decoration: none;
  9. color: #666;
  10. }
  11. li {
  12. list-style: none;
  13. }
  14. @media screen and (min-width: 480px) {
  15. :root {
  16. font-size: 12px;
  17. }
  18. }
  19. @media screen and (min-width: 640px) {
  20. :root {
  21. font-size: 14px;
  22. }
  23. }
  24. @media screen and (min-width: 720px) {
  25. :root {
  26. font-size: 16px;
  27. }
  28. }
  29. @media screen and (min-width: 1080px) {
  30. :root {
  31. font-size: 18px;
  32. }
  33. }
  34. /* 菜单栏 */
  35. .home-a .header-a {
  36. background-color: rgb(236, 189, 189);
  37. display: grid;
  38. grid-template-columns: 5rem 1fr 5rem;
  39. place-items: left;
  40. color: #fff;
  41. }
  42. .home-a .header-a li {
  43. font-size: 15px;
  44. color: blue;
  45. }
  46. .home-a .header-a .icon {
  47. width: 1em;
  48. height: 1em;
  49. vertical-align: -0.15em;
  50. fill: currentColor;
  51. overflow: hidden;
  52. font-size: 30px;
  53. }
  54. .home-a .search .icon {
  55. width: 1em;
  56. height: 1em;
  57. vertical-align: -0.15em;
  58. fill: currentColor;
  59. overflow: hidden;
  60. font-size: 20px;
  61. }
  62. .home-a .search form input {
  63. min-height: 30px;
  64. min-width: 30px;
  65. outline: none;
  66. border: none;
  67. color: gray;
  68. background-color: black;
  69. }
  70. /* */
  71. /* 导航 */
  72. .main .navs {
  73. display: flex;
  74. padding: 0.6rem 0.5rem;
  75. place-content: space-evenly;
  76. place-items: center;
  77. flex-direction: row;
  78. align-items: center;
  79. }
  80. .main .navs .icon-a {
  81. display: flex;
  82. flex-direction: column;
  83. place-items: center;
  84. font-size: 14px;
  85. color: #666;
  86. }
  87. .main .nvas .icon-a .icon-b {
  88. width: 4rem;
  89. height: 4rem;
  90. }
  91. .main .navs img {
  92. height: 40px;
  93. width: 40px;
  94. }
  95. /* 轮播图 */
  96. .picture {
  97. width: 100vw;
  98. height: 60px;
  99. position: relative;
  100. }
  101. .picture .imglist {
  102. width: 100%;
  103. height: 200px;
  104. }
  105. .picture .imglist img {
  106. width: 100%;
  107. height: 300px;
  108. }
  109. .picture .imglist a {
  110. display: none;
  111. }
  112. .picture .imglist a.active {
  113. display: block;
  114. }
  115. .picture .button {
  116. width: 6rem;
  117. height: 3rem;
  118. position: absolute;
  119. top: 10rem;
  120. right: 0em;
  121. display: flex;
  122. justify-content: center;
  123. }
  124. .picture .button .item {
  125. height: 1.1rem;
  126. width: 1.1rem;
  127. border-radius: 50%;
  128. background-color: #ccc;
  129. margin: 0.6rem;
  130. }
  131. .picture .button .item:hover {
  132. cursor: pointer;
  133. }
  134. .picture .button .item.active {
  135. background-color: #e90e9c;
  136. }
  137. /* 产品区 */
  138. .list-container {
  139. margin: 2rem 0;
  140. display: grid;
  141. grid-template-rows: 3rem 1fr;
  142. background-color: #fff;
  143. }
  144. .list-container .title-ctnr {
  145. display: flex;
  146. padding: 4.5rem;
  147. place-content: space-between;
  148. place-items: center;
  149. }
  150. .list-container .title-ctnr span {
  151. color: grey;
  152. }
  153. .list-container .title-ctnr h5 {
  154. font-size: 1rem;
  155. }
  156. .list-container .block-ctnr {
  157. width: 100%;
  158. padding: 2.5rem;
  159. display: grid;
  160. grid-template-columns: repeat(2, 1fr);
  161. grid-template-rows: repeat(2, 1fr);
  162. gap: 1rem;
  163. }
  164. .list-container .block-ctnr li {
  165. height: 15rem;
  166. }
  167. .list-container .block-ctnr li img {
  168. width: 100%;
  169. height: 10rem;
  170. }
  171. .cover-cont .mov-detail {
  172. font-size: 1.4rem;
  173. }
  174. .cover-cont .mov-info {
  175. margin-top: 1rem;
  176. display: flex;
  177. place-content: space-between;
  178. align-items: baseline;
  179. color: grey;
  180. }
  181. /* footer */
  182. .footer {
  183. display: flex;
  184. padding: 0;
  185. place-content: space-evenly;
  186. place-items: center;
  187. flex-direction: row;
  188. align-items: center;
  189. }
  190. .footer li {
  191. font-size: 20px;
  192. color: black;
  193. }
  194. .footer .icon {
  195. width: 1em;
  196. height: 1em;
  197. vertical-align: -0.15em;
  198. fill: currentColor;
  199. overflow: hidden;
  200. font-size: 45px;
  201. }

效果图



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