306 of 313 menu

Universal selector in CSS

The universal selector * allows you to select all elements.

Syntax

* { }

Example

Let's select all the elements and color them red:

* { color: red; }

Example

Let's select all the elements inside the div tag and color them red:

div * { color: red; }

Example

Let's select all the elements directly inside the div tag and color them red:

div > * { color: red; }

Example

Let's select all elements that are inside the span tag, which in turn is inside any tag that in turn is inside the div tag:

div * span { color: red; }

See also

  • the border-width property
    that specifies a border width
  • the border-style property
    that specifies a border type
  • the border property
    that is a shorthand property for a border
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline