[英]How to use a CSS attribute selector to target a specific height?
So basically, I want to only style the first specific box on my site. 所以基本上,我只想在我的网站上设置第一个特定的方框。
I would like to try and use an attribute selector to target height
(trust me, there was no other way of styling this, I literally tried everything). 我想尝试使用属性选择器来定位
height
(相信我,没有其他方式来设计这个,我确实尝试了一切)。
I have tried the following (along with many other variations): 我尝试了以下(以及许多其他变体):
.first_child[style='height: 299px;']:first-child {
background-color: red;
}
.clear[style='height: 299px;']:first-child {
background-color: red;
}
.first_child:first-of-type [height='299px;'] {
background-color: red;
}
Although, I just can't seem to get it working. 虽然,我似乎无法让它工作。
Is this fixable, or am I attempting the impossible? 这是可以解决的,还是我尝试不可能?
Below is a screenshot of my HTML structure if needed: 下面是我的HTML结构的屏幕截图,如果需要:
Try *= instead of just =, and make sure of exact text match. 尝试* =而不是只是=,并确保完全匹配文本。 That said, it's a very bad idea.
那就是说,这是一个非常糟糕的主意。 Try something else:
尝试别的东西:
#content div.columns div.clear:first-child > div.child:first-child {}
.clear:first-child .child:first-child {
background-color: red;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.