I used the following CSS bit to fix the problem on webkit. If JS is not enabled, it works under the assumption that the browser is likely to be full-screen, so the width of the viewport on webkit will be an odd number
CSS
@media screen and (-webkit-min-device-pixel-ratio:0) { html { margin-left: 1px; } html.evenWidth { margin-left: 0px; } }
JavaScript (jquery)
$(document).ready(function { var oWindow = $(window), htmlEl = $('html'); function window_width() { if(oWindow.width() % 2 == 0) { htmlEl.addClass('evenWidth'); } else { htmlEl.removeClass('evenWidth'); } } $(document).ready(function(){ window_width(); $(window).resize(window_width); });
Algy taylor
source share