Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pixel wide gaps between each <div> with flexbox due to pixel rounding error

How do I remove the black lines that seem to be caused by errors in rounding fractions of a pixel? This appears to be an issue with Chrome only, Firefox seems to be doing more intelligent rounding and renders it perfectly.

Is there an easy solution for this problem?

This is how Chrome renders it:

Chrome bug

  .container {
    height: 100px;
    width: 100%;
    background-color: black;
    display: flex;
    flex-flow: nowrap column;
  }
  .row {
    background-color: lightgreen;
    flex: 1 1 auto;
  }
<div class="container">
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
</div>
like image 757
ceilingkatt Avatar asked Feb 08 '23 06:02

ceilingkatt


1 Answers

you may try to fil the gap(?) with box-shadow

.container {
    height: 100px;
    width: 100%;
    background-color: black;
    display: flex;
    flex-flow: nowrap column;
  }
  .row {
    background-color: lightgreen;
    flex: 1 1 auto;
    box-shadow:0 1px lightgreen;
  }
<div class="container">
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
  <div class="row"></div>
</div>
like image 64
G-Cyrillus Avatar answered Feb 11 '23 01:02

G-Cyrillus