css - 如何组合多个选择?

标签 css css-selectors

如何将这两个规则合二为一?

#body_splash{
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
}
#body_main{
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
}

我试过了

#body_splash #body_main

#body_splash#body_main

但都没有用

最佳答案

用逗号分隔:

#body_splash,
#body_main {
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
}

关于css - 如何组合多个选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35880997/

相关文章:

javascript - 使用 JavaScript/jQuery 返回基于高亮文本的 CSS 选择器列表

css - 是否可以将 last-child 与内联样式一起使用而不是在 CSS 文件中使用?

css - 将 CSS 样式应用于名称开头相同但结尾不同的 ID 元素

css - 在 Eclipse 中使用 HTML5 CSS

javascript - 使用 JavaScript 和 HTML5 预览图像

CSS/IE7 - div 中的文本未居中,div 后有额外的分隔符

html - wordpress 生成的 css 未被应用

html - 单个选择器上的多个伪类

html - 如何防止在响应式网页上水平滚动?

html - 在 CSS3 中创建形状模型按钮