Summary 3

What is CSS?

CSS stands for Cascading Style Sheets and is used to style web pages. It describes how HTML elements should be displayed on various media, including screens and paper. CSS saves work by allowing control over the layout of multiple web pages simultaneously through external stylesheets stored in CSS files.

CSS Syntax and Structure

A CSS rule consists of a selector that points to the HTML element to be styled and a declaration block containing one or more declarations. Each declaration includes a CSS property name and a value, separated by a colon, with multiple declarations separated by semicolons. The declaration block is surrounded by curly braces, forming the basic structure of CSS rules.

CSS Selectors

CSS selectors are used to target specific HTML elements for styling. They can be divided into five categories: simple selectors (based on name, id, class), combinator selectors, pseudo-class selectors, pseudo-elements selectors, and attribute selectors. Simple selectors include element selectors (e.g., p), id selectors (e.g., #para1), and class selectors (e.g., .center), allowing for precise targeting of HTML elements.