snipt

Ctrl+h for KB shortcuts

CSS

Force a page break when printing a web page

1
2
3
4
5
<style type="text/css">
.pagebreak {page-break-after: always;}
</style>

<br class="pagebreak" />
https://snippets.siftie.com/embed/dc37749658f5ad304f88da92b21cba4a/
/raw/dc37749658f5ad304f88da92b21cba4a/
dc37749658f5ad304f88da92b21cba4a
css
CSS
5
2019-02-18T22:37:13
True
False
False
/api/public/snipt/14221/
force-a-page-break-when-printing-a-web-page
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="o">&lt;</span><span class="nt">style</span> <span class="nt">type</span><span class="o">=</span><span class="s2">&quot;text/css&quot;</span><span class="o">&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="nc">.pagebreak</span> <span class="p">{</span><span class="nb">page-break-after</span><span class="o">:</span> <span class="nb">always</span><span class="p">;}</span> </span><span id="L-3"><a name="L-3"></a><span class="o">&lt;/</span><span class="nt">style</span><span class="o">&gt;</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="o">&lt;</span><span class="nt">br</span> <span class="nt">class</span><span class="o">=</span><span class="s2">&quot;pagebreak&quot;</span> <span class="o">/&gt;</span> </span></pre></div> </td></tr></table>
break, css, page, print, printer