Introduction

CSS (Cascading Style Sheets) is the language used to style the visual presentation of web pages.

It works alongside HTML, which provides structure, while CSS controls color, layout, and typography.

Selectors

A selector targets the HTML elements you want to style.

You can select by tag, class, id, or attribute.

p { color: navy; } .button { padding: 8px; }
The Box Model

Every element is a rectangular box made of content, padding, border, and margin.

div { padding: 16px; border: 1px solid; }

Understanding the box model is key to controlling spacing.

Positioning

The position property controls how an element sits in the document flow.

.box { position: absolute; }

Values include static, relative, absolute, fixed, and sticky.

Responsive Design

Responsive design lets one site adapt to any screen size.

@media (min-width: 768px) { }

Media queries apply styles based on the device.