From b9aec5d9a55bc0b3ee83d7b6c2e01ebc8eb55623 Mon Sep 17 00:00:00 2001 From: Paul Hayes Date: Tue, 4 Feb 2020 15:21:02 +0000 Subject: [PATCH] Add display override for hiding content when printing When printing users often need to print the content without the surrounding site furniture (eg menus, breadcrumbs, back links and footers). Introduce a helper so that a class can be used to hide any given element from the print view. This is explicit and preferable to listing all the selectors for things that shouldn't be printed. These lists grow unwieldy over time. --- CHANGELOG.md | 6 ++++++ src/govuk/overrides/_display.scss | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c62f7905..a08eb53713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ### New features +#### Add display override for hiding content when printing + +Introduce a CSS class that can be used to hide any given element from the print view: `govuk-!-display-none-print` + +[Pull request #1723: Add display override for hiding content when printing](https://github.com/alphagov/govuk-frontend/pull/1723). + ### Fixes ## 3.5.0 (Feature release) diff --git a/src/govuk/overrides/_display.scss b/src/govuk/overrides/_display.scss index 892897218a..c9ad857c26 100644 --- a/src/govuk/overrides/_display.scss +++ b/src/govuk/overrides/_display.scss @@ -19,4 +19,10 @@ .govuk-\!-display-none { display: none !important; } + + @include govuk-media-query($media-type: print) { + .govuk-\!-display-none-print { + display: none !important; + } + } }