ASCII码 ASCII码

京东导航变色作业

发布于:2022-05-11 16:30:30  栏目:技术文档

  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. <title>定位做导航</title>
  7. <style>
  8. *{
  9. padding: 0px;
  10. }
  11. li{
  12. width: 80px;
  13. list-style: none;
  14. font-size: 13px;
  15. line-height: 30px;
  16. text-align: center;
  17. margin-left: 2px;
  18. }
  19. a{
  20. text-decoration: none;
  21. color: white;
  22. }
  23. nav{
  24. width: 800px;
  25. height: 30px;
  26. margin:auto;
  27. background: red;
  28. }
  29. nav>ul{
  30. width: 800px;
  31. height: 30px;
  32. background: red;
  33. }
  34. li:nth-child(2){
  35. position: relative;
  36. left: 80px;
  37. top: -30px;
  38. }
  39. li:nth-child(3)
  40. {
  41. position: relative;
  42. left: 160px;
  43. top: -60px;
  44. }
  45. li:nth-child(4){
  46. position: relative;
  47. left: 240px;
  48. top: -90px;
  49. }
  50. li:nth-child(5){
  51. position: relative;
  52. left: 320px;
  53. top: -120px;
  54. }
  55. li:nth-child(6){
  56. position: relative;
  57. left: 400px;
  58. top: -150px;
  59. }
  60. li:hover{
  61. background: white;
  62. border-top: 1px solid red;
  63. }
  64. li:hover>a{
  65. color: black;
  66. }
  67. </style>
  68. </head>
  69. <body>
  70. <nav>
  71. <ul>
  72. <li><a href="#">前端</a></li>
  73. <li><a href="#">前端</a></li>
  74. <li><a href="#">前端</a></li>
  75. <li><a href="#">前端</a></li>
  76. <li><a href="#">前端</a></li>
  77. <li><a href="#">前端</a></li>
  78. </ul>
  79. </nav>
  80. </body>
  81. </html>
相关推荐
阅读 +