我正在使用带有预定义类 (cbFormFieldCell) 的 CMS。 所以我无法更改某些类元素,因为它们在网站的其他部分使用。如果我更改该类的每个元素的格式,网站就会崩溃。
我只想在 <table class="tabelle">
中更改类“cbFormFieldCell”的样式.表格之外的其他元素可能不会更改。
.cbFormFieldCell { min-width: 300px; max-width: 300px; overflow: hidden;}
这适用于网站的每个类别。但是有些东西坏了。
是否可以这样做:
仅更改表 class="tabelle"中的预定义 class="cbFormFieldCell"元素?
例如
.tabelle.cbFormFieldCell
{ min-width: 300px; max-width: 300px; overflow: hidden; }
有人能帮忙吗?
最佳答案
CSS 类之间的“空格”用于定位不同的元素。您将在下面找到一个示例,当您组合不带或带空格的类时会发生什么。
希望这能帮助您了解如何定位您的元素。
.parent-1 .child {
color: green;
}
.parent-2.child {
color: red;
}
/* addition styling */
p {
padding: 20px;
background-color: #eff0f1;
border-radius: 10px;
}
<!-- Without container -->
<p class="child">No CSS rules are applied here.</p>
<!-- With containers -->
<div class="parent-1">
<p class="child">This will be targeted: green</p>
</div>
<div class="parent-2">
<p class="child">No CSS rules are applied here.</p>
</div>
<div class="parent-2 child">
<p class="child">This will be targeted: red</p>
</div>
关于css - 仅在表格内设置类样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56989498/