

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 that has no children with 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>
- Related Questions & Answers
- Style every <p> element that is the only <p> element of its parent with CSS
- Style every <p> element that is the first <p> element of its parent with CSS
- Style every <p> element that is the last <p> element of its parent with CSS
- Style every <p> element that is the nth <p> element of its parent with CSS
- Style every <p> element with a lang attribute value with CSS
- Selects every <ul> element that are preceded by a <p> element with CSS
- Style every <p> element that is the only child of its parent with CSS
- Style every <p> element that is the second child of its parent with CSS
- Style every checked <input> element with CSS
- Style every disabled <input> element with CSS
- Style every enabled <input> element with CSS
- Style every <p> elements that is the last child of its parent with CSS
- Style every <p> elements that is the first child of its parent with CSS
- Style every <p> element that is the child of its parent, counting from the last child with CSS
- Style <input> element with no "required" attribute with CSS
Advertisements