I’d like to assign a style to a HTML element – but only in the event that the tag has some contents set.
Is this possible using pure CSS? Ideally I would like to avoid JS or server-side changes to the structure of the HTML itself.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CSS3 has an
:emptypseudo -class.I can’t see any way of doing this in pure CSS2.1.