0

What does the * element in CSS mean?

What is the * element in CSS? What are the features and how to use them?

4th Jul 2024, 11:30 PM
Nguyễn Viễn
Nguyễn Viễn - avatar
3 ответов
+ 5
* is the wildcard symbol in CSS. It will match everything. It can be useful for CSS reset files. For example: * { color: white; background-color: black } would set every element to be in dark mode. * { box-sizing: border-box } would set the sizing rule for all elements to border-box (something I use in my CSS reset files)
5th Jul 2024, 1:23 AM
Sam
+ 2
Wondering if the * element helps format every element in CSS?
5th Jul 2024, 1:44 AM
Nguyễn Viễn
Nguyễn Viễn - avatar
+ 2
Nguyễn Viễn yes, the wildcard * will format all elements. An element followed by the wildcard will match all descendants of the matched element. "*" Matches all elements. "<selector> *" would match all descendants of "<selector>" Example: "article *" would select all descendants of article tags.
5th Jul 2024, 2:49 AM
Sam