
Three-section layouts are among the most popular designs on the web. You might see three side-by-side columns highlighting services, pricing tiers, or product features, or a classic page split into header, content, and footer rows. Three sections strike a natural balance: enough room to organize information clearly without overwhelming visitors. This guide shows you how to divide a web page into 3 sections HTML and CSS style, covering both column-based and row-based approaches, along with responsive techniques that keep everything readable on mobile screens.
Let AAMAX.CO Design Your Layout
Choosing the right layout for your content can significantly affect engagement and conversions. AAMAX.CO is a full-service digital marketing company offering web development, digital marketing, and SEO services worldwide. Their team designs balanced, responsive layouts that present information clearly and guide visitors to take action. Whether you need a services showcase or a complete website, their website design experts can create a structure that fits your brand and goals.
Two Ways to Think About Three Sections
When people talk about dividing a page into three sections, they usually mean one of two things. The first is three vertical columns placed side by side, such as a left sidebar, main content, and right sidebar, or three equal feature cards. The second is three horizontal rows stacked from top to bottom, typically a header, a main content area, and a footer. Both are easy to build with modern CSS, and many pages combine them.
Step 1: Write the HTML Structure
For three columns, create a wrapper element, such as a section with a class like three-columns, and place three child elements inside it. If each column contains independent content like a service description, use article elements; if they are general groupings, use div elements. Give each column a heading and content. For three rows, use semantic elements directly: a header, a main element, and a footer. This structure is meaningful even before you add any CSS.
Step 2: Create Three Equal Columns With Flexbox
Set the wrapper's display property to flex and add a gap value to create consistent spacing between columns. Then give each child a flex value of one, which tells the browser to share available space equally among them. The result is three columns of equal width that automatically adjust as the container resizes. Add padding, backgrounds, and border radius to turn each column into an attractive card.
Step 3: Create Three Columns With CSS Grid
CSS Grid offers an even more concise solution. Set the wrapper to display grid and define grid-template-columns using the repeat function with three columns of one fractional unit each. Add a gap value for spacing. Grid ensures that all columns align perfectly and that rows of cards line up neatly if you add more items later. You can create unequal columns too, such as a narrow left sidebar, wide center content, and narrow right sidebar, by specifying values like one fr, three fr, and one fr.
Step 4: Build Three Stacked Rows
To divide a full page into header, content, and footer rows, apply a grid to the body or a page wrapper with grid-template-rows set to auto, one fr, and auto. Give the wrapper a minimum height of the full viewport. The header and footer take only the space they need, while the main section expands to fill the remaining height. This technique keeps the footer at the bottom of the screen even when content is short, solving the classic sticky footer problem without hacks.
Step 5: Combine Rows and Columns With Grid Areas
For a classic holy grail layout, combine rows and columns using named grid areas. Define a grid with three columns and three rows, then assign names: the header spans the full top row, the left sidebar, main content, and right sidebar occupy the middle row, and the footer spans the bottom row. Each element is assigned to its area with the grid-area property. Named areas make the layout easy to read and rearrange.
Step 6: Make the Layout Responsive
Three columns look great on desktops but become cramped on phones. Use a mobile-first approach: by default, display the sections in a single column, then add a media query that switches to three columns once the screen is wide enough, typically around 768 pixels or more. With Flexbox, you can achieve a similar effect by enabling flex-wrap and giving each column a minimum flex-basis. With Grid, the repeat function combined with auto-fit and minmax creates columns that automatically wrap without any media queries at all.
Step 7: Ensure Equal Heights and Alignment
Both Flexbox and Grid stretch items to equal heights by default, so cards in a row line up neatly even when their content differs in length. To align buttons at the bottom of each card, make each card a flex container with a column direction and push the button down using an automatic top margin. Consistent alignment creates a polished, professional appearance.
Accessibility and Content Order
Keep the HTML source order logical, because screen readers and keyboard users follow it regardless of visual placement. Avoid using CSS to dramatically reorder content in ways that confuse navigation. Give each section a clear heading so users can jump between them, and maintain sufficient color contrast for text inside colored columns.
Common Mistakes to Avoid
Do not use HTML tables to create layout columns; they are meant for data and complicate responsive design. Avoid fixed pixel widths that break on smaller screens, and resist adding unnecessary wrapper divs. Finally, test the layout with real content of varying lengths, since placeholder text often hides alignment issues.
Conclusion
Dividing a web page into three sections is straightforward with semantic HTML and modern CSS. Use Flexbox or Grid for side-by-side columns, Grid rows for header, content, and footer layouts, and named grid areas when you need both. Build mobile-first, keep content accessible, and test thoroughly. With these techniques, you can create balanced, attractive three-section layouts for any type of website.
