style.less 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. a{
  2. text-decoration: none;
  3. color: #fff;
  4. &:hover{
  5. color: rgb(197,196,196);
  6. }
  7. }
  8. // 导航条的外部容器
  9. .top-bar-wrapper{
  10. background-color: #000;
  11. }
  12. .top-bar{
  13. max-width: 1200px;
  14. margin: 0 auto;
  15. height: 48px;
  16. padding: 0 14px;
  17. display: flex;
  18. align-items: center;
  19. justify-content: space-between;
  20. }
  21. // 设置左侧的导航图标
  22. .left-menu{
  23. &:active{
  24. // 显示隐藏的菜单
  25. .nav{
  26. display: block;
  27. }
  28. }
  29. // position: relative;
  30. // 设置菜单
  31. .nav{
  32. display: none;
  33. position: absolute;
  34. top: 48px;
  35. left: 0;
  36. bottom: 0;
  37. right: 0;
  38. // 设置背景颜色
  39. background-color: #000;
  40. padding-top: 60px;
  41. li{
  42. width: 80%;
  43. margin: 0 auto;
  44. border-bottom: 1px solid #1f1f1f;
  45. a{
  46. display: block;
  47. line-height: 44px;
  48. font-size: 14px;
  49. }
  50. &:last-child a{
  51. display: inline-block;
  52. margin-right: 6px;
  53. }
  54. span{
  55. color: #fff;
  56. font-size: 14px;
  57. }
  58. }
  59. }
  60. // 图标
  61. .menu-icon{
  62. width: 18px;
  63. height: 48px;
  64. position: relative;
  65. // 导航的线
  66. li{
  67. width: 18px;
  68. height: 1px;
  69. background-color: #fff;
  70. position: absolute;
  71. // 修改变形的原点
  72. transform-origin: left center;
  73. transition: 0.5s;
  74. }
  75. li:nth-child(1){
  76. top: 18px;
  77. }
  78. li:nth-child(2){
  79. top: 24px;
  80. }
  81. li:nth-child(3){
  82. top: 30px;
  83. }
  84. // 鼠标移入以后的效果,正常项目时,效果需要通过js来实现
  85. &:active{
  86. li:nth-child(1){
  87. top: 18px;
  88. // 向下旋转
  89. transform: rotateZ(40deg);
  90. }
  91. li:nth-child(2){
  92. top: 24px;
  93. // 隐藏
  94. opacity: 0;
  95. }
  96. li:nth-child(3){
  97. top: 30px;
  98. transform: rotateZ(-40deg);
  99. }
  100. }
  101. }
  102. }
  103. // 设置logo
  104. .logo{
  105. a{
  106. text-indent: -9999px;
  107. display: block;
  108. width: 122px;
  109. height: 32px;
  110. background-image: url('../img/dff63979.sprites-index@2x.png');
  111. background-size: 400px 400px;
  112. }
  113. }
  114. // 设置媒体查询
  115. @media only screen{
  116. // 断点
  117. @media(min-width:768px){
  118. .left-menu{
  119. order: 2;
  120. flex:auto;
  121. // 显示菜单
  122. .nav{
  123. display: flex;
  124. position: static;
  125. padding: 0;
  126. justify-content: space-around;
  127. li{
  128. width: auto;
  129. border-bottom: none;
  130. margin: 0;
  131. a{
  132. line-height: 48px;
  133. }
  134. span{
  135. display: none;
  136. }
  137. }
  138. }
  139. // 隐藏菜单图标
  140. .menu-icon{
  141. display: none;
  142. }
  143. }
  144. .logo{
  145. order: 1;
  146. }
  147. .user-info{
  148. order: 3;
  149. }
  150. }
  151. }