CSS Tutorial
CSS (Cascading Style Sheets) is the language that makes web pages look good. HTML decides what is on the page; CSS decides how it looks: the colors, fonts, spacing, and layout, and how the page changes on a small phone screen versus a wide laptop.
This free course has 33 short lessons. Each one teaches one idea with examples you can edit live, a list of common mistakes, a Taglish summary and a quick quiz.
Before you start
You should already know basic HTML: elements, attributes, classes and ids. If not, take the HTML Tutorial first, at least up to the Class and Id lesson. CSS makes much more sense once you can write a simple page.
What you'll be able to do
- Change colors, backgrounds, fonts and spacing with confidence
- Understand the box model, the idea behind every layout
- Build modern layouts with Flexbox and CSS Grid
- Make pages that look good on phones, tablets and laptops
- Add hover effects, transitions and simple animations
- Style a complete page for a small business, from scratch
All lessons
Getting Started
- What Is CSS? An Introduction for BeginnersLearn what CSS is, what it does to an HTML page, and see the same page before and after CSS — your first step to designing websites.
- CSS Syntax — Selectors, Properties, Values and CommentsLearn how to read and write a CSS rule — selector, curly braces, property, colon, value and semicolon — plus how to write comments.
- How to Add CSS — Inline, Internal and External Style SheetsThe three ways to add CSS to an HTML page — inline styles, the style element, and an external .css file — and when to use each one.
- CSS Selectors — Element, Class, Id, Group and DescendantLearn how to pick exactly the elements you want to style using element, class, id, universal, group, descendant and child selectors.
Colors & the Box Model
- CSS Colors — Names, HEX, RGB, HSL and OpacityColor text and backgrounds with CSS using color names, HEX, RGB and HSL, add transparency, and build a simple color palette for your website.
- CSS Backgrounds — Colors, Images, Size and PositionAdd background colors and images with CSS, control repeat, size and position, and build a hero banner with text over an image.
- CSS Borders and Rounded CornersDraw borders around elements with CSS — width, style and color — style each side separately, and make rounded corners and circles with border-radius.
- CSS Margin and Padding — Spacing Made SimpleUnderstand the difference between padding (space inside) and margin (space outside), use the 1-, 2-, 3- and 4-value shorthands, and center a box with margin auto.
- The CSS Box Model, Width, Height and box-sizingEvery element is a box. Learn the four layers of the CSS box model, how width and height are calculated, and why box-sizing border-box makes layouts easier.
Text & Content
- CSS Text — Alignment, Decoration, Spacing and TransformStyle text with CSS — align it, underline or remove underlines, change letter case, and adjust line height and letter spacing for easy reading.
- CSS Fonts — Family, Size, Weight and Google FontsChoose fonts with font-family and fallbacks, set sizes and weights, use the font shorthand, and add free Google Fonts to your website.
- CSS Units — px, %, em, rem, vw and vh ExplainedUnderstand absolute and relative CSS units — pixels, percentages, em, rem, viewport units — and learn which one to use for fonts, spacing and layout.
- Styling Links and Buttons with CSSStyle links in all their states — link, visited, hover, focus and active — and turn links into good-looking, accessible buttons and navigation menus.
- Styling Lists with CSS — Bullets, Numbers and MenusChange list bullets and numbering, use custom markers and emojis, remove bullets for menus, and build a styled checklist with CSS.
- Styling Tables with CSSTurn plain HTML tables into clean, readable data tables — borders, border-collapse, padding, zebra stripes, hover rows and mobile-friendly scrolling.
Layout
- CSS Display — block, inline, inline-block and noneThe display property decides how an element sits on the page. Learn block, inline, inline-block and none, plus the difference between display none and visibility hidden.
- CSS Position — relative, absolute, fixed and stickyMove elements out of the normal flow with the position property — relative, absolute, fixed and sticky — and control stacking with z-index.
- CSS Overflow, Float and Object-fitControl content that doesn't fit with overflow, wrap text around images with float, and crop images neatly with object-fit.
- CSS Flexbox — The Flex ContainerLearn Flexbox, the easiest way to line things up in a row or column — display flex, flex-direction, justify-content, align-items, gap and flex-wrap.
- CSS Flexbox — Flex Items, flex-grow and Real LayoutsControl individual flex items with flex-grow, flex-shrink, flex-basis, the flex shorthand, align-self and order, then build cards, a sidebar layout and a sticky footer.
- CSS Grid — Rows, Columns and the fr UnitBuild two-dimensional layouts with CSS Grid — grid-template-columns, the fr unit, repeat(), gap, and responsive galleries with auto-fit and minmax.
- CSS Grid Template Areas — Drawing Page LayoutsName the parts of your page and "draw" the layout with grid-template-areas, align grid items, and build a complete responsive page layout.
Responsive Design
- CSS Media Queries — Different Styles for Phones and LaptopsUse media queries to change your layout at different screen sizes, choose sensible breakpoints, and support dark mode and printing.
- Responsive Web Design — Images, Typography and TestingPut it all together — fluid containers, responsive images, fluid font sizes with clamp(), touch-friendly design and how to test your site on many screen sizes.
Selectors & the Cascade
- CSS Pseudo-classes — :hover, :focus, :nth-child and MoreStyle elements based on their state or position — hover, focus, checked, first-child, nth-child, not, and form validation states like valid and invalid.
- CSS Pseudo-elements — ::before, ::after and MoreAdd decorative content with ::before and ::after, style the first letter and line, the placeholder and text selection, and learn the sibling combinators + and ~.
- CSS Specificity, the Cascade and InheritanceFind out why a style "doesn't work" — how the cascade decides which rule wins, how specificity is counted, how inheritance works, and why to avoid !important.
- CSS Variables (Custom Properties) and calc()Store colors, sizes and spacing in CSS variables, reuse them everywhere, build a light and dark theme, and do math with calc().
Effects & Animation
- CSS Gradients and ShadowsCreate smooth color blends with linear, radial and conic gradients, and add depth with box-shadow and text-shadow — without any image files.
- CSS Transforms and TransitionsMove, rotate, scale and skew elements with transform, and make style changes happen smoothly with transition — perfect for hover effects.
- CSS Animations with @keyframesCreate animations that play on their own with @keyframes — loading spinners, pulses, fades and a jeepney driving across the screen — and respect reduced-motion settings.
Going Further
- Styling Forms with CSSMake forms clean and easy to use — style inputs, labels, focus states, buttons, checkboxes and select menus, and lay out a mobile-friendly registration form.
- CSS Final Project — Style a Small Business WebsiteUse everything from the course to style a complete one-page website for a local business — header, hero, menu cards, about section, contact and footer — step by step.
Keep a reference handy
The CSS Property List lists the properties used in this course, with a short explanation of each and the lesson that teaches it.