Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display:table div with percentage width 1px bug

The outer div have percentage width, and inner div's have display: tabel; width: 100%.

The inner div's show 1px less than outer div for some page widths while resizing. This adds an 1px line to the right.

enter image description here

https://jsfiddle.net/afelixj/utcswLp1/1/

Is there any fix for the bug?

like image 312
Felix A J Avatar asked Jul 30 '15 09:07

Felix A J


Video Answer


1 Answers

@media screen and (-webkit-min-device-pixel-ratio:0) {
    width: calc(100% + 0.5px);
}

Notes:

  • adding 1px doesn't fix the problem on WebKit … it just inverts it
  • adding 0.5px introduces the problem on some non-WebKit browsers … wrapping it in a media query resolves this
like image 61
bryn Avatar answered Sep 30 '22 17:09

bryn