website-building-css-responsive-design
ITIAN Website Building Short Course
Technology Simplified — Solutions That Work
Style a Responsive Page with CSS
Create a clear ITIAN-inspired visual system and make the page adapt smoothly from phones to large screens.
By the end of this lesson, you can…
- Connect styles.css correctly.
- Use selectors, properties, values and reusable custom properties.
- Apply the box model, Grid or Flexbox and responsive images.
- Test readability, focus visibility and layout at different widths.
Before you begin
What you need
- The complete HTML page from Lesson 3.
- The empty styles.css file in the project folder.
- A small colour palette with strong text contrast.
Starter check
Open index.html and styles.css side by side. Confirm the unstyled page works before adding CSS so structure and styling problems remain separate.
Understand and demonstrate the skill
CSS controls presentation while HTML keeps the structure meaningful. A small reusable system for colour, spacing, typography and layout produces a more consistent page than many isolated declarations.
Key terms
Selector, property and value
The selector chooses the HTML; the property names what changes; the value defines the setting.
Cascade
The rules CSS uses to resolve competing declarations.
Box model
Content surrounded by padding, border and margin.
Media query
A conditional CSS block for a viewport or user preference.
Follow the demonstration
- Set predictable foundations. Apply box-sizing, body margin, type, line height, colours and responsive images.
- Create design tokens. Store core colours, content width and spacing as custom properties.
- Style content and actions. Improve headings, sections, links and buttons while keeping focus obvious.
- Add a flexible layout. Use Grid with minmax or a targeted media query.
- Test several widths. Resize gradually and fix the content where it breaks, not for a named device.
Worked example
* { box-sizing: border-box; }
:root {
--navy: #061424;
--gold: #d4af37;
--green: #7ed957;
}
body {
margin: 0;
color: #172536;
font: 1rem/1.6 Arial, sans-serif;
}
img { max-width: 100%; height: auto; }
.cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: 1rem;
}
a:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
Complete the guided activity
Style your HTML page with one consistent palette, readable typography, flexible spacing and a layout that works without horizontal scrolling.
- Prepare. styles.css is linked and the browser applies it.
- Build. Text has readable line length, spacing and contrast.
- Check. Links and buttons have visible hover and keyboard-focus states.
- Record. The page works at narrow and wide widths without horizontal scrolling.
Activity checklist
Check your understanding
Answer all three questions, then review any topic that needs another look.
Review, reflect and continue
Success criteria
- The same page is readable on phone-sized and desktop-sized views.
- Colours, spacing and typography are consistent.
- Interactive controls remain obvious for mouse and keyboard users.
Reflection prompt
Which CSS change improved the page most, and which design choice will you reuse on future pages?