From ac18104d0b1017a86f771ca5e0dc04f613c339a1 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Thu, 14 Sep 2017 15:55:25 -0400 Subject: [PATCH] Reduce blank pages when printing in Chrome Close #29 --- CHANGELOG.md | 5 + _sass/basically-basic/_print.scss | 30 +- docs/_sass/basically-basic/_print.scss | 396 +++++++++++++------------ 3 files changed, 244 insertions(+), 187 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ac93db..2401fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Fixed +- `/_sass/_print.scss` to reduce blank pages when printing in Chrome. [#29](https://github.com/mmistakes/jekyll-theme-basically-basic/issues/29) + ## [1.1.1] - 2017-09-06 ### Changed - Change `gems` key in `_config.yml` to `plugins`. [#23](https://github.com/mmistakes/jekyll-theme-basically-basic/pull/23) diff --git a/_sass/basically-basic/_print.scss b/_sass/basically-basic/_print.scss index 83090fd..61fdf91 100644 --- a/_sass/basically-basic/_print.scss +++ b/_sass/basically-basic/_print.scss @@ -17,17 +17,20 @@ html { margin: 0; padding: 0; + height: auto; + min-height: auto !important; font-size: 16px; } body { - margin: 0 auto; + margin: 0; + height: auto; background: #fff !important; color: #000 !important; font-size: 1rem; + line-height: 1.5; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; - line-height: 1.5; text-rendering: optimizeLegibility; } @@ -185,6 +188,26 @@ content: ' (' attr(title) ')'; } + .wrapper { + min-height: auto !important; + } + + #main { + max-width: 100%; + } + + .inner { + margin: 0; + padding: 0; + width: 100%; + max-width: 100%; + } + + .intro-actions .btn { + color: #fff; + background: #000; + } + .page-break, .page-break-before { page-break-before: always; @@ -216,11 +239,14 @@ Hide the following elements on print ========================================================================== */ + .skip-links, .sidebar-toggle-wrapper, + .sidebar, .title-area, .pager, .site-footer, .adsbygoogle { display: none !important; + height: 1px; } } diff --git a/docs/_sass/basically-basic/_print.scss b/docs/_sass/basically-basic/_print.scss index 83090fd..d9289ca 100644 --- a/docs/_sass/basically-basic/_print.scss +++ b/docs/_sass/basically-basic/_print.scss @@ -2,225 +2,251 @@ PRINT STYLES ========================================================================== */ -@media print { + @media print { - [hidden] { - display: none; - } + [hidden] { + display: none; + } - * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - } + * { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + } - html { - margin: 0; - padding: 0; - font-size: 16px; - } + html { + margin: 0; + padding: 0; + height: auto; + min-height: auto !important; + font-size: 16px; + } - body { - margin: 0 auto; - background: #fff !important; - color: #000 !important; - font-size: 1rem; - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - line-height: 1.5; - text-rendering: optimizeLegibility; - } + body { + margin: 0; + height: auto; + background: #fff !important; + color: #000 !important; + font-size: 1rem; + line-height: 1.5; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + } - h1, - h2, - h3, - h4, - h5, - h6 { - margin-top: 0; - margin-bottom: 0.75rem; - color: #000; - line-height: 1.2; - } + h1, + h2, + h3, + h4, + h5, + h6 { + margin-top: 0; + margin-bottom: 0.75rem; + color: #000; + line-height: 1.2; + } - h1 { - font-size: 2.5rem; - } + h1 { + font-size: 2.5rem; + } - h2 { - font-size: 2rem; - } + h2 { + font-size: 2rem; + } - h3 { - font-size: 1.75rem; - } + h3 { + font-size: 1.75rem; + } - h4 { - font-size: 1.5rem; - } + h4 { + font-size: 1.5rem; + } - h5 { - font-size: 1.25rem; - } + h5 { + font-size: 1.25rem; + } - h6 { - font-size: 1rem; - } + h6 { + font-size: 1rem; + } - a { - background: none; - color: #000; - text-decoration: underline; - word-wrap: break-word; - } + a { + background: none; + color: #000; + text-decoration: underline; + word-wrap: break-word; + } - table { - border-collapse: collapse; - } + table { + border-collapse: collapse; + } - thead { - display: table-header-group; - } + thead { + display: table-header-group; + } - table, - th, - td { - border-bottom: 1px solid #000; - } + table, + th, + td { + border-bottom: 1px solid #000; + } - td, - th { - padding: 8px 16px; - } + td, + th { + padding: 8px 16px; + } - img { - display: block; - max-width: 100% !important; - border: 0; - vertical-align: middle; - } + img { + display: block; + max-width: 100% !important; + border: 0; + vertical-align: middle; + } - hr { - height: 0; - margin: 2.25rem 0; - padding: 0; - border: 0; - border-bottom: 2px solid #bbb; - } + hr { + height: 0; + margin: 2.25rem 0; + padding: 0; + border: 0; + border-bottom: 2px solid #bbb; + } - dt { - font-weight: bold; - } + dt { + font-weight: bold; + } - dd { - margin: 0; - margin-bottom: 0.75rem; - } + dd { + margin: 0; + margin-bottom: 0.75rem; + } - abbr[title], - acronym[title] { - border: 0; - text-decoration: none; - } + abbr[title], + acronym[title] { + border: 0; + text-decoration: none; + } - table, - blockquote, - pre, - code, - figure, - li, - hr, - ul, - ol, - a, - tr { - page-break-inside: avoid; - } + table, + blockquote, + pre, + code, + figure, + li, + hr, + ul, + ol, + a, + tr { + page-break-inside: avoid; + } - h2, - h3, - h4, - p, - a { - orphans: 3; - widows: 3; - } + h2, + h3, + h4, + p, + a { + orphans: 3; + widows: 3; + } - h1, - h2, - h3, - h4, - h5, - h6 { - page-break-after: avoid; - page-break-inside: avoid; - } + h1, + h2, + h3, + h4, + h5, + h6 { + page-break-after: avoid; + page-break-inside: avoid; + } - h1 + p, - h2 + p, - h3 + p { - page-break-before: avoid; - } + h1 + p, + h2 + p, + h3 + p { + page-break-before: avoid; + } - img { - page-break-after: auto; - page-break-before: auto; - page-break-inside: avoid; - } + img { + page-break-after: auto; + page-break-before: auto; + page-break-inside: avoid; + } - pre { - white-space: pre-wrap !important; - word-wrap: break-word; - } + pre { + white-space: pre-wrap !important; + word-wrap: break-word; + } - a[href^='http://']::after, - a[href^='https://']::after, - a[href^='ftp://']::after { - font-size: 80%; - content: ' (' attr(href) ')'; - } + a[href^='http://']::after, + a[href^='https://']::after, + a[href^='ftp://']::after { + font-size: 80%; + content: ' (' attr(href) ')'; + } - abbr[title]::after, - acronym[title]::after { - content: ' (' attr(title) ')'; - } + abbr[title]::after, + acronym[title]::after { + content: ' (' attr(title) ')'; + } - .page-break, - .page-break-before { - page-break-before: always; - } + .wrapper { + min-height: auto !important; + } - .page-break-after { - page-break-after: always; - } + #main { + max-width: 100%; + } - .no-print { - display: none; - } + .inner { + margin: 0; + padding: 0; + width: 100%; + max-width: 100%; + } - a.no-reformat::after { - content: ''; - } + .intro-actions .btn { + color: #fff; + background: #000; + } - abbr[title].no-reformat::after, - acronym[title].no-reformat::after { - content: ''; - } + .page-break, + .page-break-before { + page-break-before: always; + } - .btn { - background: none; - color: #000; - } + .page-break-after { + page-break-after: always; + } -/* - Hide the following elements on print - ========================================================================== */ + .no-print { + display: none; + } - .sidebar-toggle-wrapper, - .title-area, - .pager, - .site-footer, - .adsbygoogle { - display: none !important; - } -} + a.no-reformat::after { + content: ''; + } + + abbr[title].no-reformat::after, + acronym[title].no-reformat::after { + content: ''; + } + + .btn { + background: none; + color: #000; + } + + /* + Hide the following elements on print + ========================================================================== */ + + .skip-links, + .sidebar-toggle-wrapper, + .sidebar, + .title-area, + .pager, + .site-footer, + .adsbygoogle { + display: none !important; + height: 1px; + } + }