Using CSS and the following example, is there a way to select only <p>‘s that are followed by <ul>‘s?
If not, what is the jQuery selector, or would it require an if statement?
<p>Hello there.</p>
<p>Select this para!</p>
<ul>
<li>list item</li>
</ul>
<ul>
<li>don't select this list! :)</li>
</ul>
<p>And don't select this paragraph! :)</p>
It’s not possible in CSS3, the best you can do is select only the
<ul>which follow<p>:However it will be possible when browsers start implementing the CSS4 subject operator:
In the meantime, you’ll have to use jQuery and walk the DOM back.