[CSS Selector] *
Using '*' (asterisk), you can apply styles to all elements.
Sample Code
style.css
/* Apply red text color and zero margin to all elements */
* { color: red; margin: 0;}
/* CSS reset pattern commonly used in stylesheets */
* { margin: 0; padding: 0; box-sizing: border-box;}
/* Apply a style to all descendants of a specific element */
.container * { font-family: sans-serif;}
/* Apply only to direct children (combined with child combinator) */
.menu > * { display: inline-block; padding: 8px 16px;}
Browser Result
* { color: red; margin: 0;}
<div>This is a div element.</div> <p>This is a p element.</p>
Browser Support
Desktop
8 ○
7 ○
6 ×
2 and earlier ×Mobile
Android Browser
4.4+ ○
3 and earlier ×Same support as desktop version.
Same support as desktop version.
* Version information is based on MDN.
If you find any errors or copyright issues, please contact us.