且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在CSS中的另一个特定元素之前设置最后一个元素的样式?

更新时间:2023-01-08 08:55:42


这样的东西可以单独使用CSS吗?

Is something like this achieveable with CSS alone?

尚未。

如果主题选择器,那么您可以使用:

If the subject selector gets implemented, then you'd be able to use:

!p + h4 {
    ...
}



However that specification is still in an early draft state, so implementation is a ways off. You'd be better off using classes for the time being.