-
What are CSS Selectors?
CSS is an acronym for Cascading Style Sheets. While HTML documents describe the framework of elements within a webpace, CSS describes how these HTML elements are visually displayed.
Kinds of CSS Selectors
- element selectors
- id selectors
- class selectors
CSS Element Selectors
Using CSS can save you a lot of work. Rather than adding styling to each individual element in an HTML document, you can modify multiple documents on multiple pages with one sheet.
Syntax:
Syntax CSS Syntax HTML elementname { declarations } < elementtag > content < /elementtag >
CSS ID Selectors
Using CSS can save you a lot of work. Rather than adding styling to each individual element in an HTML document, you can modify multiple documents on multiple pages with one sheet.
Syntax:
Name Definition Syntax CSS Syntax HTML Class selects elements based off specific class .elementname { declarations } < tag class="idname" > content < /tag >
CSS Class Selectors
Using CSS can save you a lot of work. Rather than adding styling to each individual element in an HTML document, you can modify multiple documents on multiple pages with one sheet.
Syntax:
Syntax CSS Syntax HTML elementname { declarations } < elementtag > content < /elementtag >
Selector Reference
Name Definition Syntax CSS Syntax HTML Element selects elemetns based off element name elementname { declarations } < elementtag > content < /elementtag > ID select specific elements by using the ID attribute #elementname { declarations } < tag id="idname" > content < /tag > Class selects elements based off specific class .elementname { declarations } < tag class="idname" > content < /tag >
CSS Syntax
CSS Parts
Name Definition Selector selects what HTML element you want to style Attributes / Styles specific visual changes for different selectors Declaration includes a CSS property name and a value, seperated by a semicolon Property what attribute you are changing Value what you are changing the attribute to