Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari doesn't display multi-column layout when printing

I'm developing a webapp where I need to print a report. The report has recommendations that get displayed in two columns:

.container {
  column-count: 2;
}
<div class="container">
  <p>recommendation 1</p>
  <p>recommendation 2</p>
  <p>recommendation 3</p>
  <p>recommendation 4</p>
  <!-- repeat many times -->
</div>

This works great in all browsers except for Safari. Safari lays out the page correctly in the browser, but falls back to single-column layout otherwise.

What can I do to prevent this behavior and make Safari keep the multi-column layout even when printing?

NOTE: I've verified this behavior happens with the exact code above but obviously it can't be tested without pasting the code into a separate file.

like image 270
BonsaiOak Avatar asked Nov 20 '22 03:11

BonsaiOak


1 Answers

Unfortunately, multicolumn print layout doesn't work in Safari. See this for the proof.

For me personally, I found only one solution - use table, but that needs manual algorithm to split text into columns.

like image 162
ka8725 Avatar answered Mar 27 '23 07:03

ka8725