I have this HTML with multiple <br> tags.
<br>
<br>
<br>
<br>
<br>
TITLE
<br>
<br>
foo bar
<br>
foo bar
...
I want to keep only single and double breaks at most (new line and new paragraph) and I want to ignore all extra <br>. So having maximum 2 <br> one after another. So,
<br><br><br><br><br>TITLE<br><br>foo bar<br>foo bar<br><br><br>foo bar
would become
<br><br>TITLE<br><br>foo bar<br>foo bar<br><br>foo bar
How can I do this with CSS?
I would like to select all <br> elements who have at least 2 immediate previous <br> siblings
EDIT: for a bit more of context, the HTML is on an external web site, I try to improve the reading with firefox/stylish, so only with CSS
By using :nth-child selector you can achieve it easily.
CSS:
br:nth-child(3n + 3) { display: none; }
SEE DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With