liveBook · Manning

Responsive web design

As explained in Web Design Playground, Second Edition

Responsiveness is the ability of a web page layout to adapt effectively to different screen sizes and device orientations.

Responsive web design makes layouts, typography, images, and other content adapt to different screen sizes and orientations. The goal is simple: pages should remain usable, readable, and navigable without maddening horizontal scrolling. section 14.0

Build responsiveness from a sturdy starting point:

  • Size elements to their borders with box-sizing: border-box, then configure the viewport so the page matches the device width at its natural scale. section 14.2
  • Start with the smallest practical layout, usually a smartphone width, and include only the content and actions users truly need. section 14.5
  • Add complexity through media queries as the screen becomes wider instead of trying to squeeze a desktop layout into a phone. section 14.5

A sidebar that waits for room

A narrow layout can use one grid column and hide a quotation sidebar. At 750 pixels and above, a media query expands the grid to four columns and reveals the sidebar. Small screens stay focused; wider screens get the extra furniture. section 14.5

.container {
    display: grid;
    grid-template-columns: 1fr;                   #1
    grid-template-areas:                          #1
        "header"                                  #1
        "article"                                 #1
        "sidebar"                                 #1
        "footer";                                 #1
}
.quotation {
    display: none;                                #2
}
@media (min-width: 750px) {
    .container {
        grid-template-columns: repeat(4, 1fr);    #3
        grid-template-areas:                      #3
            "header header header header"         #3
            "quotation article article sidebar"   #3
            "footer footer footer footer";        #3
    }
    .quotation {
        display: block;                           #4
        grid-area: quotation;
    }
}

Inspect the complete mobile-first grid rule and its wider-screen media query, including the layout areas and sidebar visibility change. section 14.5

Responsiveness is also a practical debugging target: a portfolio that works on desktop and landscape tablets may still need breakpoints before it behaves on smartphones. section 20.6

How Web Design Playground, Second Edition covers it

How deep it goes
Explains prerequisites, fluid layouts, media queries, mobile-first priorities, images, fonts, and measurements through guided examples.
Examples
Uses a grid with a hidden quotation sidebar on smartphones and a portfolio page needing breakpoints for smaller screens.
What it assumes
Assumes basic HTML and CSS while explicitly teaching box sizing and viewport configuration before responsive layout work.
What you can do after
Build it from scratch by configuring the viewport, starting mobile-first, and adding media-query layout changes for wider screens.
How it connects
Connects responsive design with CSS Grid, media queries, viewport configuration, fluid images, and mobile-first design.

Also explained in

Compare how 7 books explain responsive web design →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.