我正在尝试创建一个样式规则以将 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/