I would like to find the simplest way to trim the empty
tags before any text starts. for example i have the below text.
<p> </p><p> </p>
<p> </p><p> </p>
<p> </p>
<p>This is an example<br></p><p> </p><p>continue </p>
I would like the output to be <p>This is an example<br></p><p> </p><p>continue </p>
I want all the empty P tags to be removed. There can be more than one space between
tags.
I have the options to use CSS or VB or c#.
You have tagged your question in css. So, I'm providing you an answer in css using :empty pseudo class selector:
p:empty{
display: none;
}
See can I use :empty
As per your updated question:
you can use not like below:
p:empty :not(p + p:empty){
display: none;
}
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