Lecture 4 Cascading Style Sheet (CSS) Sarsenova Zh. N.
Cascading Style Sheet • When a browser reads a style sheet, it will format the HTML document according to the information in the style sheet. • CSS is a language that describes the style of an HTML document. • CSS describes how HTML elements should be displayed.
CSS Syntax • A CSS rule-set consists of selector and a declaration block: • The selector points to the HTML element you want to style. • The declaration block contains one or more declarations separated by semicolons. • Each declaration includes a CSS property name and a value, separated by a colon. • A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces
For several elements • First three heading levels have blue letters: h 1, h 2, h 3{color: blue}
Ways to insert CSS • Inline • Internal • External
Inline CSS • An inline CSS is used to apply a unique style to a single HTML element. • An inline CSS uses the style attribute of an HTML element. • Example: • This is a Blue Heading
Internal CSS • An internal CSS is used to define a style for a single HTML page. • An internal CSS is defined in the
section of an HTML page, within a