Selector - Tag (Element selector)

> (World Wide) Web - (W3|WWW) > Selector API

1 - About

A tag selector selects element in the DOM tree.

3 - Example

3.1 - 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

3.2 - 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 */ 

Advertising
web/selector/tag.txt · Last modified: 2019/02/09 11:43 by gerardnico