我在 css 中有这个问题,例如我在 css 中有两个不同的状态
#koolbutton .active {
color: #fff
}
#koolbutton{
color: #ccc //not active
}
当我尝试这个 html 时
<button id ="koolbutton" class="active">
它给了我正常的灰色 koolbutton 而不是白色的事件按钮!谢谢
最佳答案
您需要省略 #koolbutton
和 .active
之间的空格。
#koolbutton { /*not active*/ }
#koolbutton.active { /*active*/ }
关于html - 如何在CSS中给出两种不同的状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11882681/