Additional margin over column using column-count with CSS3 and WebKit
Asked Answered
A

1

6

I'm trying to use the column-count css3 property on an tag with multiple paragraphs in it. On Webkit browsers I'm seeing what appears to be a bug. At certain screen sizes, paragraph margins are failing to split across columns nicely.

Here's a screen shot (notice that the third paragraph starting with the word "Duis" is dropped whereas it should be flush with the top of the screen):

enter image description here

Here's a CodePen of the problem. I've fixed the width to 1000px so the problem is obvious to Chrome* / Safari users.

*Edit: Just checking back in early 2018 and Chrome no longer suffers from this bug. Safari (testing 11.0.3) does!

I've attempted to use the page-break-* rules to force paragraphs to avoid breaks. I've also tried to use -webkit-perspective:1 as per the comments at http://caniuse.com/#feat=multicolumn but that's had no effect.

Any ideas folks?

article {
  -webkit-column-count: 2;
  -moz-column-count: 2;
  column-count: 2;
  width: 1000px;
}

p {
  margin-top: 0;
  margin-bottom: 1.3em;
}
<article>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</article>
Australorp answered 6/10, 2015 at 11:43 Comment(0)
W
6

Just add inside p:

display: inline-block;
Wolfie answered 6/10, 2015 at 12:15 Comment(2)
Wow... that simple. Thank you ;)Australorp
is there also another way of fixing this when display:inline-block is not possible to use?Provocation

© 2022 - 2024 — McMap. All rights reserved.