
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Style Every p Element with No Children Using CSS
To style every <p> element that has no children with CSS, use the: empty selector t. You can try to run the following code to implement the: empty selector
Example
<!DOCTYPE html> <html> <head> <style> p.demo { width: 300px; height: 20px; background: gray; } p:empty { width: 150px; height: 20px; background: orange; } </style> </head> <body> <p class = "demo">This is demo text. Below is empty text.</p> <p></p> </body> </html>
Advertisements