简体   繁体   English

汉堡菜单,如何更改十字架的颜色

[英]Hamburger menu, how to change color of cross

What should I do because I have a problem. 我遇到问题应该怎么办。 There was something wrong with X button on this menu I did It myself, and everything is correct but when I try to change color of X there is an error. 我自己做的菜单上的X按钮有问题,一切正常,但是当我尝试更改X的颜色时出现错误。 I would like to change the color of X to the black one. 我想将X的颜色更改为黑色。 Theres a code 有一个代码

<button class="js-menu menu" type="button">
    <span class="bar"></span>
</button>

<nav>
    <ul>
        <li>Lorem ipsum</li>
        <li>Lorem ipsum</li>
        <li>Lorem ipsum</li>
        <li>Lorem ipsum</li>
        <li>Lorem ipsum</li>       
    </ul>
</nav>

Change the background of the class .active:after .active:before 更改类的背景.active:after .active:before

.active & {
  background: none;
  &:after,
  &:before{
     background: red;
  }

http://codepen.io/pranesh-r/pen/gwkNwY http://codepen.io/pranesh-r/pen/gwkNwY

You can change color with .active class 您可以使用.active类更改颜色

.active & {
    background: none;
    &:before,
    &:after {
       top: 0;
       background:red
    }
}

Add background color to the psuedo selectors in your CSS. background color添加到CSS中的psuedo选择器。 Add the following to your code 将以下内容添加到您的代码中

.active .bar::before, .active .bar::after {
    top: 0;
    background: #000;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM