This lesson plan outlines the objectives, prerequisites, and exclusions of the lesson teaching students how to apply basic Cascading Style Sheets (CSS) to format and style elements on a web page.
Students should already be familiar with:
Students will not cover:
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML. CSS controls the layout of multiple web pages all at once.
CSS allows you to separate content from design, making it easier to maintain and update your website. It enables you to apply styles consistently across multiple pages.
A CSS rule consists of a selector and a declaration block:
selector {
property: value;
}
For example:
h1 {
color: blue;
font-size: 24px;
}
This changes the color of all <h1> elements to blue and sets their font size to 24 pixels.
Selectors are used to target HTML elements. Common selectors include:
* - selects all elements.class - selects elements with a specific class#id - selects an element with a specific IDelement - selects all instances of a specific element type (e.g., p, h1)CSS properties define how elements should be styled. Some common properties include:
color - sets the text colorbackground-color - sets the background color of an elementfont-size - sets the size of the text fontmargin - sets the space outside an elementpadding - sets the space inside an element, between its content and its border