What is CSS?
CSS (Cascading Style Sheets) is the language used to style HTML documents. It controls:- Colors and backgrounds
- Fonts and typography
- Spacing and layout
- Animations and transitions
- Responsive design
The “Cascade” in CSS
CSS applies styles in order of specificity (from lowest to highest):- Browser default styles (user agent)
- External stylesheets (
<link>) - Internal styles (
<style>in<head>) - Inline styles (
style="...") - !important (avoid using)
Basic Syntax
Example from our project:
CSS Reset
Browsers apply default styles that vary between them. A “reset” normalizes these styles for consistency.Modern CSS Reset (Box-Sizing)
The
* selector targets all elements. Using box-sizing: border-box makes width calculations more predictable.Why box-sizing: border-box?
HTML & Body Setup
Key Properties Explained
scroll-behavior: smooth- Animates navigation to anchor links instead of jumpingmin-height: 100vh-100vh= 100% of viewport height, ensures body fills screen- Font smoothing properties improve text rendering on different browsers
Element Resets
Images
Lists
Links
Buttons
Inputs
Accessibility: Focus States
:focus-visibleonly shows focus ring during keyboard navigation, not mouse clicksoutline-offsetcreates space between the outline and element border
Next Steps
Now that you understand CSS basics and resets, let’s explore:Selectors
Learn different ways to target elements
Variables
Create reusable design tokens
Box Model
Master spacing and sizing
BEM Methodology
Write maintainable CSS