html - 如何在CSS中给出两种不同的状态?

标签 html css

我在 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/

相关文章:

jquery - 如何根据加载的页面使用 jquery 设置 CSS 样式?

html - CSS 样式 WordPress 小部件

html - @media 适用于 CSS。有没有 html 的东西?

html - 联系表格宽度问题

javascript - 如何在移动浏览器的视口(viewport)宽度和高度上将元素居中?

css - 设置表格行之间线条的粗细

html - 我想在模块中使用的 css 放在哪里?

javascript - 当加载不同参数的相同 url 时,Angular2 路由器 2.0.0 不重新加载组件?

javascript - 将图像上传到 Canvas 并在新选项卡中显示

html - float :left; problem in ie6?