Basics of Web Authoring and Design

{CSS Selectors}

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 CSSSyntax 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:

NameDefinitionSyntax CSSSyntax HTML
Classselects 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 CSSSyntax HTML
elementname { declarations }< elementtag > content < /elementtag >

Selector Reference

NameDefinitionSyntax CSSSyntax HTML
Elementselects elemetns based off element nameelementname { declarations }< elementtag > content < /elementtag >
IDselect specific elements by using the ID attribute#elementname { declarations }< tag id="idname" > content < /tag >
Classselects elements based off specific class.elementname { declarations }< tag class="idname" > content < /tag >


CSS Syntax

 photo csssyn.jpg


CSS Parts

NameDefinition
Selectorselects what HTML element you want to style
Attributes / Stylesspecific visual changes for different selectors
Declarationincludes a CSS property name and a value, seperated by a semicolon
Propertywhat attribute you are changing
Valuewhat you are changing the attribute to