CSS universal selector

The universal selector (*), matches the name of any element type. It matches any single element in the document tree. Some ways it can be used:

* matches any element
*.warning
(equivalent to .warning)
matches any element with class=warning
#id1 * matches any descendendant of element with id=id1
#id1 > * matches any direct child of element with id=id1

Example – universal selector

<style>
#id1 * {
  border: 1px solid lightblue;
}
</style>

<div id="id1">
  <p>p1</p1>
  <p>p2</p1>
</div>

<div id="id2">
  <p>p3</p1>
</div>
refresh

Related

Specification

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments