Skip to main content Intelligence Community Design System Get started Accessibility Styles Components Patterns Community

Section container

Guidance Code Accessibility

Introduction

When creating a page, use section containers to group content and align the margins with each other as well as other components.

Section containers are used in components to control alignment of their content. The following components use section containers with the specified alignments.

Component demo

Interactive example



When to use

Use a section container to group multiple elements and align them on a page. Use multiple section containers to ensure alignment between them all.

A page showing section containers used to align content to the centre of the viewport.
Use section containers maintain alignment across a page.

When not to use

Avoid nesting section containers as it can be difficult to maintain alignment. Instead, use multiple section containers to align each group of content differently.

Sizing

The size of the section container changes dependent on the size of the viewport. The margins and maximum width of the container are automatically set so that the content will respond to changes in the viewport.

Make a section container full height to remove the vertical padding and help align vertical content more easily.

Two section containers. The first section container has vertical padding included at the top and bottom of the container, whereas the second section container is full-height and has no vertical padding.
Make section containers full height to remove vertical padding and easily space content vertically.

Layout and placement

Use the alignment properties of the section container to change how they align with the viewport.

Use centre alignment to position the section container in the centre of the viewport.

An example of a page with three section containers with centred alignment appearing in the middle of the viewport.
Section containers using centred alignment.

Use left alignment to position the section container to the left of the viewport.

An example of a page with three section containers with left alignment appearing to the left of the viewport.
Section containers using left alignment.

Use full-width alignment to make the section container span the full width of the viewport.

An example of a page with three section containers with full-width alignment stretching to the edges of the viewport.
Section containers using full-width alignment.

Content

Group any combination of content within a section container. Align the content relative to the section container. By default content is aligned to the left, but overide this to create custom internal layouts, whilst having the section align automatically with other containers on the page.

Future work on this component

  • Add grids to section container to align internal content.


Last reviewed 29 August 2024 .
Navigated to Section container - Intelligence Community Design System