Basic Selectors

Selector Meaning Example
Universal Selector Applies to all elements in the document *

Targets all elements on the page

Type Selector Matches element names h1, h2, h3

Targets the <h1>, <h2>, and <h3> elements

Class Selector Matches an element whose class attribute has a value that matches the one specified after the period symbol .note

Targets any elements whose class attribute has a value of note

p.note

Targets only the <p> elements whose class attribute has a value of note.

ID Selector Matches an element whose id attribute has a value that matches the one specified after the pound or hash symbol #introduction

Targets the element whose id attribute has a value of introduction

Leave a Reply

Your email address will not be published. Required fields are marked *