have span that may or may not have text content.
is there a way to have left and right padding if and only if there is text content?
was thinking of using pseudo classes :first and :last, seeing how some css3 examples make the first character extra large for example.
will this work or is it a pipe dream?
There is an :empty
pseudo-selector that will do what you need.
span {
padding:0 20px;
}
span:empty {
padding:0;
}
More here - http://www.w3.org/TR/css3-selectors/#empty-pseudo
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