liveBook · Manning

Mobile-first layout

As explained in Web Design Playground, Second Edition

A mobile-first layout is a responsive design strategy that begins with a layout optimized for small screens and progressively enhances it for larger screens.

A mobile-first layout starts with the smallest practical screen, keeps only essential content, and adds complexity when the viewport grows. Think of it as seasoning CSS: adding is easier than scraping it off. section 14.5

Build the layout in small, visible steps:

  • Start with a minimal layout that works on a smartphone, often around 320 pixels wide—or use analytics to choose a more realistic starting width. section 14.5
  • Include only elements essential to the user experience, especially when visitors may have slow connections or limited data plans. section 14.5
  • Use media queries to add or modify layout features for wider screens rather than removing existing mobile styles. section 14.12 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;
    }
}

This pattern places header, article, sidebar, and footer in one column by default, then creates a four-column arrangement at 750 pixels and reveals the quotation sidebar. section 14.5

How Web Design Playground, Second Edition covers it

How deep it goes
Defines the strategy, explains additive CSS and content prioritization, and demonstrates a 750-pixel grid change.
Examples
Uses a quotation sidebar hidden on narrow smartphone screens and displayed on wider screens such as tablets.
What you can do after
Build it from scratch by starting with a minimal smartphone layout and adding larger-screen changes with media queries.
How it connects
Connects mobile-first layout to responsive web design, media queries, liquid layouts, and CSS Grid.

Also explained in

Compare how 4 books explain mobile-first layout →

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.