博客列表 >京东商城实例

京东商城实例

沉寂的博客
沉寂的博客原创
2021年01月07日 19:28:47978浏览

京东商城实例

代码如下:

  1. header {
  2. height: 5em;
  3. background-color: lightcoral;
  4. color: white;
  5. display: flex;
  6. padding: 1em;
  7. }
  8. /* 菜单按钮 */
  9. header .menu {
  10. flex: 1;
  11. text-align: center;
  12. font-size: 2.5em;
  13. height: inherit;
  14. }
  15. /* 搜索框 */
  16. header .search {
  17. flex: 8;
  18. display: flex;
  19. align-items: center;
  20. background-color: #fff;
  21. border-radius: 2em;
  22. }
  23. header .search .logo {
  24. font-size: 2em;
  25. color: lightcoral;
  26. margin-left: 0.5em;
  27. }
  28. header .search .zoom {
  29. font-size: 1.5em;
  30. color: #cccccc;
  31. margin-left: 0.2em;
  32. border-left: solid 1px #ccc;
  33. padding: 0.2em;
  34. }
  35. header .search .words {
  36. border: none;
  37. outline: none;
  38. color: #ccc;
  39. background-color: white;
  40. }
  41. /* 登录按钮 */
  42. header .login {
  43. flex: 1;
  44. background-color: lightcoral;
  45. border: none;
  46. outline: none;
  47. color: white;
  48. font-size: 2em;
  49. margin-left: 1em;
  50. }
  51. .container .banner a img {
  52. /* 如果想要图自动缩放效果,宽要占100% */
  53. width: 100%;
  54. }
  55. main .nav {
  56. display: flex;
  57. flex-flow: row wrap;
  58. }
  59. main .nav li {
  60. flex: 1 1 20%;
  61. display: flex;
  62. flex-flow: column nowrap;
  63. align-items: center;
  64. }
  1. <!-- 头部 -->
  2. <header>
  3. <div class="menu iconfont icon-menu"></div>
  4. <div class="search">
  5. <div class="logo">JD</div>
  6. <div class="zoom iconfont icon-search"></div>
  7. <input
  8. type="text"
  9. name="search"
  10. id="search"
  11. value="蓝牙鼠标"
  12. class="words"
  13. />
  14. </div>
  15. <button class="login">登录</button>
  16. </header>
  17. <div class="container">
  18. <div class="banner">
  19. <a href="#"><img src="static/images/bg/banner.jpg" alt="" /></a>
  20. </div>
  21. <main>
  22. <ul class="nav">
  23. <li>
  24. <a href="#"><img src="static/images/dh/nav-1.png" alt="" /></a>
  25. <a href="#">京东超市</a>
  26. </li>
  27. <li>
  28. <a href="#"><img src="static/images/dh/nav-2.png" alt="" /></a>
  29. <a href="#">数码电器</a>
  30. </li>
  31. <li>
  32. <a href="#"><img src="static/images/dh/nav-3.png" alt="" /></a>
  33. <a href="#">京东服饰</a>
  34. </li>
  35. <li>
  36. <a href="#"><img src="static/images/dh/nav-4.png" alt="" /></a>
  37. <a href="#">京东生鲜</a>
  38. </li>
  39. <li>
  40. <a href="#"><img src="static/images/dh/nav-5.png" alt="" /></a>
  41. <a href="#">京东到家</a>
  42. </li>
  43. <li>
  44. <a href="#"><img src="static/images/dh/nav-6.png" alt="" /></a>
  45. <a href="#">充值领劵</a>
  46. </li>
  47. <li>
  48. <a href="#"><img src="static/images/dh/nav-7.png" alt="" /></a>
  49. <a href="#">9.9元拼</a>
  50. </li>
  51. <li>
  52. <a href="#"><img src="static/images/dh/nav-8.png" alt="" /></a>
  53. <a href="#">领劵</a>
  54. </li>
  55. <li>
  56. <a href="#"><img src="static/images/dh/nav-9.png" alt="" /></a>
  57. <a href="#">借钱</a>
  58. </li>
  59. <li>
  60. <a href="#"><img src="static/images/dh/nav-10.png" alt="" /></a>
  61. <a href="#">PLUS会员</a>
  62. </li>
  63. <ul>
  64. </main>
  65. </div>

执行结果:
JD

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