Skip to content

Instantly share code, notes, and snippets.

@lincerely
Last active February 3, 2023 02:55
Show Gist options
  • Save lincerely/10b440fea97000effada88cde197299f to your computer and use it in GitHub Desktop.
Save lincerely/10b440fea97000effada88cde197299f to your computer and use it in GitHub Desktop.
Force column break (tested in Safari and Firefox)
<style>
body {
columns: 2;
}
* {
break-before: avoid;
break-after: avoid;
break-inside: avoid;
}
cbreak {
break-after: always;
display: block;
margin-bottom: 999999;
/** depends on your page layer, sometimes '100vh' or '100%' also works.
Try to change your window width to see how it response. **/
}
@media print {
cbreak {
margin-bottom: 0;
}
}
</style>
<h1>Heading 1</h1>
<p>London. Michaelmasterm lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p>
<h2>Heading 2</h2>
<p>London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p>
<cbreak></cbreak>
<h2>Heading 2</h2>
<p>London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment