Blogger Information
Blog 32
fans 0
comment 0
visits 22263
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
理解弹性盒子
培(信仰)
Original
543 people have browsed it

理解弹性盒子

效果图

弹性盒子

  1. <!DOCTYPE html>
  2. <html lang="en">
  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. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. li {
  14. list-style: none;
  15. }
  16. a {
  17. text-decoration: none;
  18. color: #aaa
  19. }
  20. a:hover {
  21. color: red;
  22. text-decoration: underline;
  23. }
  24. .myjd a:hover {
  25. color: red;
  26. text-decoration: underline;
  27. background-color: #fff;
  28. }
  29. .myjd:hover ul {
  30. background-color: #fff;
  31. display: block;
  32. }
  33. nav {
  34. height: 50px;
  35. margin: 0 auto;
  36. background: #ccc;
  37. }
  38. nav>ul {
  39. box-sizing: border-box;
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. }
  44. nav>ul>li {
  45. position: relative;
  46. margin: 10px 20px;
  47. }
  48. .jd-group ul {
  49. position: absolute;
  50. background: #fff;
  51. left: 0px;
  52. display: none;
  53. }
  54. .jd-group ul>li {
  55. padding: 10px 10px;
  56. width: 90px;
  57. }
  58. </style>
  59. </head>
  60. <body>
  61. <nav>
  62. <ul>
  63. <li><a href="">我的订单</a></li>
  64. <li class="myjd">
  65. <a href="">我的京东</a>
  66. <div class="jd-group">
  67. <ul>
  68. <li><a href="">我的京豆</a></li>
  69. <li><a href="">我的优惠券</a></li>
  70. <li><a href="">我的白条</a></li>
  71. <li><a href="">我的理财</a></li>
  72. </ul>
  73. </div>
  74. </li>
  75. <li><a href="">京东会员</a></li>
  76. <li><a href="">企业采购</a></li>
  77. <li><a href="">客户服务</a></li>
  78. <li><a href="">网站导航</a></li>
  79. <li><a href="">手机京东</a></li>
  80. <li><a href="">网站无障碍</a></li>
  81. </ul>
  82. </nav>
  83. </body>
  84. </html>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:导航栏可以适当优化一下,譬如 我的京东 可以居中,效果更好
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post