

- 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
Universal Selector in CSS
The CSS * selector is a universal selector which is used to select all elements of the HTML DOM.
Syntax
The syntax for CSS universal selector is as follows −
* { /*declarations*/ }
The following examples illustrate CSS universal selector −
Example
<!DOCTYPE html> <html> <head> <style> * { margin: 15px; padding: 5px; border: 2px solid black; box-shadow: inset 30px 0 8px lightblue; } </style> </head> <body> <table> <tr> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </table> </body> </html>
Output
Example
<!DOCTYPE html> <html> <head> <style> * { margin: 15px; padding: 5px; width: 200px; border: 2px solid black; } html::before { content: "one"; } </style> </head> <body> two <div>three <div>four <div>five</div> </div> </div> </body> </html>
Output
- Related Questions & Answers
- How to use universal (*) selector in jQuery?
- Universal Selectors in CSS
- Role of CSS :not (selector) Selector
- CSS Child Selector
- CSS Descendant Selector
- Is it possible to use $(this) and universal selector (*) with jQuery?
- Element Type Selector in CSS
- Role of CSS :focus Selector
- Role of CSS :hover Selector
- What is a CSS Selector?
- Role of CSS :active Selector
- Role of CSS :checked Selector
- Role of CSS: disabled Selector
- Role of CSS :empty Selector
- Role of CSS :enabled Selector
Advertisements