CSS Tutorial for Beginners
CSS (Cascading Style Sheets) controls how HTML content looks, including its colors, spacing, typography and layout. This beginner guide introduces the core ideas and gives you small examples to try.
HTML provides the structure of a page; CSS describes its presentation. A stylesheet contains rules, and each rule selects one or more HTML elements and applies declarations such as color or spacing.
Connect CSS to an HTML page
Create a file named styles.css and link it inside the document head:
<link rel="stylesheet" href="styles.css">
Start with these CSS topics
CSS selectorsChoose the elements a style rule should match.
The box modelUnderstand content, padding, borders and margins.
Flexbox layoutAlign and distribute items in one direction.CSS GridBuild flexible layouts with rows and columns.
Cascade and specificityUnderstand why one matching CSS rule wins.
Responsive designAdapt page layouts to available screen space.
PositioningPlace elements with relative, absolute and sticky rules.
Try each rule in a separate CSS file and refresh the browser to see how it changes the page.