属于嵌套在另一个元素类中的多个类的 div 元素的 CSS 样式规则

标签 css css-selectors

我正在尝试创建一个样式规则以将 Border Box 模型应用于属于以下类的 div 元素:

容器、行、以列、单元格和 a 元素开头的类,

所有这些都应该嵌套在属于单元格类的 div 元素中。

到目前为止,这是我的代码:

    div.cell > div.container div.row div[class^="column"]. div.cell div.a {box-sizing: border-box;}

有人可以告诉我我缺少什么吗?

非常感谢

最佳答案

I am trying to create a style rule to apply the Border Box model to the div elements belonging to the following classes:

container, row, classes that begin with column, cell, and a elements,

all of which should be nested within div elements belonging to the cell class.

div.cell div.container,
div.cell div.row,
div.cell div[class^="column"],
div.cell div[class^="cell"],
div.cell a {

  box-sizing: border-box;

}

这个故事的寓意是:

将您的选择器写在不同的行上,这样您就可以清楚地看到所有内容。

关于属于嵌套在另一个元素类中的多个类的 div 元素的 CSS 样式规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58984774/

相关文章:

asp.net - 使用 CSS 类

css - 根据以下元素将样式应用于 CSS 中的元素

html - :hover but :not on a specific class

javascript - Zurb Foundation 5 工具提示位置错误

css - 这是否可以在不通过 css 使用位置属性的情况下实现绝对位置功能?

html - 颜色没有被添加到第一个跨度

html - 相邻的 sibling 不工作 - CSS3 选择器

css - 如何将 css 应用于 Gtk3-css 中的所有子元素?

jquery - 单击我的 Accordion 幻灯片效果时更改图标

html - 为什么 CSS 光标属性不适用于样式滚动条?