--- url: "https://design-system.service.gov.uk/styles/spacing/" titulek: "Spacing – GOV.UK Design System" h1: "Spacing" popis: "The Design System uses a responsive spacing scale which adapts based on screen size" jazyk: "en" kanonicka: "https://design-system.service.gov.uk/styles/spacing/" drobecky: ["Home", "Styles"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 01:23:05" znaku: 5395 slov: 860 kodovani: "utf-8" sha256: "b5e2286b7f703a112224ef728add9bd24204638c7311ad7d74b0596f21a532cf" --- # Spacing The Design System uses two different spacing scales – responsive and static. ## Responsive spacing The responsive spacing scale adapts based on screen size. The spacing for ‘large screens’ is used when the screen is wider than the tablet breakpoint (640px). Spacing for the smallest units (0-3) stays the same for all screen sizes. | 0 | 0 | | --- | --- | | 5px | 5px | | 10px | 10px | | 15px | 15px | | 15px | 20px | | 15px | 25px | | 20px | 30px | | 25px | 40px | | 30px | 50px | | 40px | 60px | ## Static spacing The static spacing scale stays the same for all screen sizes, and uses the same spacing as ‘large screens’ in the responsive spacing scale. | 0 | | --- | | 5px | | 10px | | 15px | | 20px | | 25px | | 30px | | 40px | | 50px | | 60px | ## Applying spacing in your own CSS If you want to reference the spacing scale in your CSS, use the spacing helpers. ### Using the responsive spacing helper To use the responsive spacing scale, include either: - the [`govuk-responsive-margin`](https://frontend.design-system.service.gov.uk/sass-api-reference/#govuk-responsive-margin) mixin - the [`govuk-responsive-padding`](https://frontend.design-system.service.gov.uk/sass-api-reference/#govuk-responsive-padding) mixin For example, to apply spacing unit 6 for 30px padding on large screens and 20px on small screens, use: ``` @include govuk-responsive-padding(6); ``` You can also add an argument to apply margin or padding in a single direction. For example, to apply spacing unit 6 for a 30px bottom margin on large screens and a 20px bottom margin on small screens, use: ``` @include govuk-responsive-margin(6, "bottom"); ``` ### Using the static spacing helper For the static spacing scale, use the [`govuk-spacing` function](https://frontend.design-system.service.gov.uk/sass-api-reference/#govuk-spacing). For example, to apply spacing unit 6 for 30px top padding on all screens, use: ``` padding-top: govuk-spacing(6); ``` For negative spacing, use a negative spacing unit number. For example, to apply spacing unit -3 for a negative 15px top margin all screens, use: ``` margin-top: govuk-spacing(-3); ``` ## Overriding spacing Occasionally, you might need to make minor adjustments like adding or removing spacing to elements of your design. You can use the spacing override classes for this. ### Responsive spacing override classes The responsive spacing override classes start with: `govuk-!-`, followed by either `margin-` or `padding-`, and then a spacing unit number. To apply spacing in a single direction, include `left-`, `right-`, `top-`, or `bottom-` just before the spacing unit. For example, use: - `govuk-!-margin-9` to apply a 40px margin to all sides of the element on small screens, increasing to 60px on large screens - `govuk-!-padding-right-5` to apply 15px of padding to the right side of the element on small screens, increasing to 25px on large screens - `govuk-!-margin-0` to remove all margins at all screen sizes ### Static spacing override classes The static spacing override classes start with `govuk-!-static`. Use them the same way as the responsive spacing override classes. For example, use: - `govuk-!-static-margin-9` to apply a 60px margin to all sides of the element at all screen sizes - `govuk-!-static-padding-right-5` to apply 25px of padding to the right side of the element at all screen sizes - `govuk-!-static-margin-0` to remove all margins at all screen sizes, same as `govuk-!-margin-0` ### Examples - HTML HTML ```
``` - HTML HTML ```A paragraph with a margin-bottom override (spacing unit 9).
A paragraph with a margin-bottom override (spacing unit 8).
A paragraph with a margin-bottom override (spacing unit 7).
A paragraph with a margin-bottom override (spacing unit 6).
A paragraph with a margin-bottom override (spacing unit 5).
A paragraph with a margin-bottom override (spacing unit 4).
A paragraph with a margin-bottom override (spacing unit 3).
A paragraph with a margin-bottom override (spacing unit 2).
A paragraph with a margin-bottom override (spacing unit 1).
A paragraph with a margin-bottom override (spacing unit 0).
``` ## Help improve this style To help make sure that this page is useful, relevant and up to date, you can: - take part in the [‘Spacing’ discussion on GitHub](https://github.com/alphagov/govuk-design-system-backlog/issues/267) and share your research - [propose a change on GitHub](https://github.com/alphagov/govuk-design-system/edit/main/src/styles/spacing/index.md) – read more about [how to propose changes in GitHub](/community/propose-a-content-change-using-github/) ## Need help? If you’ve got a question about the GOV.UK Design System, [contact the team](/contact/).