Lesson 04 of 5 in Module 05

⏱️ 04 Mins read

CSS — what to skim first

Cascading Style Sheets (CSS) tell the browser how HTML looks: colours, fonts, spacing, layout. AI can generate a lot of CSS fast. If you try to read every line on day one, you will drown. Instead, learn a skim order: what to check first so the page is readable and maintainable before you polish shadows and animations.

This lesson helps you evaluate visual output with a repeatable method, not only “I like it.”

Introduction

CSS is declarative: you state rules, the browser applies them. When rules conflict, specificity and order decide the winner—topics you can deepen later. For now, remember: if you change a colour and nothing happens, another rule is probably winning. Search the file for the same selector or use developer tools (Inspect) in the browser to see which rule applies.

Think of CSS in layers:

  1. Can people read it? (contrast, font size, line height)
  2. Does the layout make sense? (spacing, stacking on mobile)
  3. Is the code organised? (repeated magic numbers, conflicting rules)

AI sometimes emits pretty desktop layouts with weak mobile behaviour or low contrast accent text. Your skim catches that early.

Key concepts

Selectors — who is styled?

Glance at selectors first: body, .card, #hero, nav a. Ask:

  • Are class names consistent?
  • Are there conflicting rules for the same element (same selector repeated with different values)?

If the file is chaos, consider asking AI to consolidate—after you save a backup.

Contrast — text versus background

Check body text against background. Then check links and buttons. If you squint or lean in, contrast may be too low.

You do not need perfect numbers on day one. You do need to reject grey on grey body copy for a public page.

Font size and line height

AI often uses rem or px. Skim for tiny base font sizes on mobile. If paragraphs feel cramped, look for line-height (leading) and increase it modestly.

Spacing — margin and padding

Before you animate hover states, check margin collapse surprises and padding on buttons (touch targets on phones—roughly 44px tall minimum for important taps is a common guideline).

Layout: Flexbox and Grid (high level)

AI often emits Flexbox (display: flex) or Grid (display: grid). For skim purposes:

  • Flex — good for rows of items, centring, simple nav bars.
  • Grid — good for two-dimensional layouts (cards in rows and columns).

If the layout “breaks” on mobile, look for flex-direction, flex-wrap, min-width on children, or missing max-width: 100% on images.

Media queries

Search for @media blocks. They adjust CSS for smaller screens. If your desktop looks fine but mobile is crushed, the media query section is the first place to read after base styles.

Focus styles

AI sometimes removes :focus outlines for aesthetics. Do not ship keyboard-hostile pages. If you remove default outlines, replace them with a visible custom focus style (outline or box-shadow) that meets contrast expectations.

Example — find a weak contrast pair

body {
  background: #f0f0f0;
  color: #999999;
}
a {
  color: #cccccc;
}

Problem: #999 on #f0f0f0 is often below comfortable contrast for long reading; links at #ccc may fail hard against the background.

Direction: darken text (#222–#333 range is a common readable default on light greys) and give links a clear colour with underline or obvious affordance.

Variables and tokens (when you see --something)

Modern stylesheets often use custom properties: color: var(--text); or padding: var(--space-2);. Treat them as named knobs—if contrast fails, trace back to where --text is defined (usually near the top of the file or in a tokens partial). Courses sometimes centralise palette in one place so you fix one value instead of hunting fifty greys. If AI scatters raw hex codes everywhere, a consolidation prompt can reduce future mistakes—after you back up the file.

Images and object-fit

AI-generated layouts often include hero images or avatars. Skim for img { max-width: 100%; height: auto; } so large images do not overflow on small screens. If pictures look stretched, look for fixed height without object-fit—adding object-fit: cover (with a sensible height) is a common fix for cropped hero areas. You do not need to master every property on day one; you need to know where layout pain usually hides.

Print and reduced motion (optional skim)

Some stylesheets include @media print or @media (prefers-reduced-motion: reduce). If present, glance at them: print rules avoid shipping black text on white for no reason on paper; reduced-motion rules respect users who get dizzy from large animations. If AI adds heavy animation without a reduced-motion fallback, note it as a review item—not always blocking for a class draft, but part of professional polish.

When to stop skimming and start testing

Skim sets direction; resize the browser and tab through links prove behaviour. Five minutes of real device or narrow-window testing often beats an hour of staring at CSS. Keep that balance: read enough to suspect problems, then confirm with interaction.

Remember: your capstone’s Lighthouse accessibility score rewards both HTML structure and CSS choices such as visible focus and sufficient contrast—skimming CSS is part of whole-page quality, not a side hobby.

Practice

Task — Three-item skim list

Write your three-item checklist you will run on every AI stylesheet before nitpicking. Use your words. Example shape (do not copy):




Task — Apply

Open your practice style.css. Skim for five minutes. Note one improvement you could make (even if you do not code it yet).

Key takeaways

  • Skim selectors, contrast, type, spacing—before micro-design.
  • Accessibility and mobile behaviour often hide in CSS, not only HTML.
  • Creative direction includes visual hierarchy—not only words on the page.

What’s next

Next up: freeCodeCamp and other free foundations (optional depth)