From c6f2972adafb17ef1ea48237141b8f00a5426203 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..e5e0e6aee5 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-!-print-display-none` + +[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..054be4bc45 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-\!-print-display-none { + display: none !important; + } + } }