liveBook · Manning

One-column layout

As explained in Build a Website with ChatGPT

A single-column layout is a page layout in which content regions are arranged in one vertical column spanning the available width.

A one-column layout arranges page content in one vertical column. On narrow screens, it gives each region the full screen width instead of squeezing content into multiple narrow columns. section 12.2.9

Use a CSS media query to switch to one column when the viewport is 500px wide or less. The article and aside then appear one after the other. section 12.2.9

@media (max-width: 500px) {
    main {
        display: grid;
        grid-template-columns: 1fr;
    }
}

This CSS makes the main element a one-column grid on screens no wider than 500px. section 12.2.9

Portfolio on a smartphone

A portfolio can use multiple columns on a desktop, two columns on a tablet, and a single-column layout on a smartphone. Test each screen size to confirm that the layout adapts as expected. section 11.3

How Build a Website with ChatGPT covers it

How deep it goes
Explains the layout change through media queries and gives a concrete 500px CSS Grid rule.
Examples
Uses an article with an aside and a portfolio page that changes from desktop columns to one smartphone column.
What you can do after
Apply it via CSS media queries to create a readable mobile layout and test it across screen sizes.
How it connects
Connects responsive design with adaptive layouts, media queries, CSS Grid, and viewport width.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.