且构网

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

一个标记的选择器,后面紧跟另一个标记

更新时间:2022-10-14 21:04:18



编辑:为了更有帮助,如果您使用例如jQuery(JavaScript库),您可以使用 .prev()


This selects all <B> tags directly preceded by <A> tags:

A+B {
    /* styling */
}

What is the selector for all <A> tags directly followed by <B> tags?

Here's sample HTML fitting my question:

<a>some text</a>
<b>some text</b>

You can’t in css.

Edit: To be a bit more helpful, if you use for example jQuery (a JavaScript library), you can use .prev().