Selector - Tag (Element selector)

About

A tag selector selects element in the DOM tree.

Example

List of tag selector

/* Selects all level 1 headings  */
h1
 /* Selects all paragraphs */ 
p
/* Selects all strong elements */
strong
/* Selects all em elements */
em
/* Selects all divs */
div
/* Selects all mama's tag (who knows ?) */
mama

Css

  • The HTML
<!-- The p official HTML tag -->
<p>I will be blue</p>
<!-- <mama> is not a official HTML, XML tag but you can still use it -->
<mama>Mama will be pink</mama>
  • The CSS selector p.
p /* select all p */ 
{ color:blue; } /* and color them in blue */ 
mama /* select all mama */ 
{ color:pink; } /* and color them in pink */ 

Powered by ComboStrap