TutreNews Learn

CSS Fundamentals: Styling the Web

Learn how CSS works: selectors, the cascade and specificity, the box model, units, colours and text, then modern layout with display, positioning, Flexbox, Grid and responsive design. Finish by building a styled card and a responsive page.

Beginner · 3 units · 11 lessons · 92 exercises · ~1.9 h

What you will learn

  • Write CSS rules and select elements with type, class, id, combinators and pseudo-classes
  • Predict which rule wins using specificity, source order and inheritance
  • Calculate sizes with the box model, box-sizing and relative units
  • Style text and colours accessibly
  • Lay out pages with Flexbox, Grid and positioning
  • Make a page responsive with media queries

Prerequisites

  • HTML basics: elements, attributes and document structure

Learning path

1 Rules, selectors and the cascade

  1. What CSS does and how a rule is built8 min · 6 exercises
  2. Selectors11 min · 6 exercises
  3. The cascade, specificity and inheritance12 min · 6 exercises
  4. Unit exam6 exercises

2 Box model, units and text

  1. The box model11 min · 6 exercises
  2. Units and colours10 min · 7 exercises
  3. Text and fonts9 min · 5 exercises
  4. Unit exam6 exercises

3 Layout and responsive design

  1. Display and positioning11 min · 5 exercises
  2. Flexbox12 min · 6 exercises
  3. CSS Grid11 min · 6 exercises
  4. Responsive design with media queries10 min · 6 exercises
  5. Building a card and debugging with DevTools11 min · 5 exercises
  6. Unit exam6 exercises
  1. Final exam10 exercises

Practical project: Style a responsive profile page

  1. Create index.html with a header (name and a navigation with three links), a main with an introduction, a section with six project cards (title, short text, link) and a footer.
  2. Create style.css. Start with box-sizing: border-box, a readable font stack, line-height: 1.6 and colours with a contrast ratio of at least 4.5:1 (check with an online contrast checker).
  3. Build the navigation with Flexbox and gap. Add :hover and :focus-visible styles.
  4. Lay the cards out with Grid: one column on phones, two from 600px, three from 900px (mobile-first, with the viewport meta tag).
  5. Style the card as in the lesson: border, radius, padding, a button, and a small badge positioned with position: absolute inside a position: relative card.
  6. Open the browser DevTools, inspect two elements, and write down for each one: the winning selector, its specificity, and the computed box sizes.
  7. Test at 360px, 768px and 1200px wide and fix anything that overflows.

References

Related courses