...

View Full Version : Banner shifted 1px in Chrome in presence of scrollbar



meridionaljet
08-13-2011, 10:13 PM
Hello,

I am developing a website, and I have a disturbing little rendering issue in Google Chrome. On a page where I have inserted a bit of content, my banner is shifted 1px to the left, extending outside of the wrapper to the left, and leaving a white space between itself and the right-hand edge of the wrapper. On other pages of the same site to which I have not yet added much content, this does not happen.

The issue seems to stem from the fact that the page with lots of content now requires a vertical scrollbar (at least on my screen: 1366x768). The other pages do not yet need a scrollbar, but they will, which means this problem will be widespread in Chrome if I cannot resolve it. Firefox does not exhibit this problem, and the banner remains snug within the boundaries of the wrapper.

Any help with this would be appreciated.

Screenshots:

Right side of page banner without a scrollbar:

http://i55.tinypic.com/15zhwtz.jpg

Right side of page banner with a scrollbar:

http://oi55.tinypic.com/r9h743.jpg

HTML for the page with need for a scrollbar:


<!DOCTYPE html>
<html>
<head>
<title>Tropical Tidbits - Analysis Tools</title>
<meta name="description" content="Tropical Tidbits - tropical weather and Atlantic hurricane information, analysis, and forecasts" />
<meta name="keywords" content="tropical,tidbit,tidbits,atlantic,hurricane,weather,storm,Levi,Cowan,Levi Cowan,analysis,information,forecast,cyclone,ocean,caribbean,united states,tracking,models,news,depression,honduras,nicaragua,jamaica,cuba,puerto rico,florida,gulf of mexico,radar,satellite,surface,data,loops,maps,current,invest,africa,rain,wind,flooding,storm surge,meteorology,official" />
<meta name="author" content="Levi Cowan" />
<link rel="stylesheet" type="text/css" href="common-styles.css" />
<style>
#title {
color: #860000;
font-size: 1.6em;
}

p { width: 800px; }

table { border-spacing: 20px 0; }

table, tr, td { margin: 0; padding: 0; }

tr { height: 180px; }

td { width: 300px; }

td, #satellite a:hover, #radar a:hover, #surface a:hover, #models a:hover, #ocean a:hover, #upper a:hover {
border-radius: 12px;
-moz-border-radius: 12px; /*Support for older browsers*/
-webkit-border-radius: 12px;
}

td a {
display: block;
height: 180px;
}

#satellite { background: url('images/satellite.png') 0 -180px; }

#satellite a:hover {
background: url('images/satellite.png') 0 0;
}

#radar { background: url('images/radar.png') 0 -180px; }

#radar a:hover {
background: url('images/radar.png') 0 0;
}

#surface { background: url('images/surface.png') 0 -180px; }

#surface a:hover {
background: url('images/surface.png') 0 0;
}

#models { background: url('images/models.png') 0 -180px; }

#models a:hover {
background: url('images/models.png') 0 0;
}

#ocean { background: url('images/ocean.png') 0 -180px; }

#ocean a:hover {
background: url('images/ocean.png') 0 0;
}

#upper { background: url('images/upper.png') 0 -180px; }

#upper a:hover {
background: url('images/upper.png') 0 0;
}

</style>
</head>
<body>
<div id="wrapper">
<div id="banner">
<ul id="navbar">
<li><a href="index.html">Home</a></li>
<li><a href="storminfo.html">Current Storm Info</a></li>
<li><a href="invest-tracking.html">Invest Tracking</a></li>
<li id="current-page"><a href="analysis.html">Analysis Tools</a></li>
<li><a href="links.html">Links Database</a></li>
</ul>
</div> <!-- end banner -->
<div id="main-section">
<span id="title">Tropical Weather Analysis Tools</span>
<p>There are many different scientific tools that are at our disposal for analyzing hurricanes and tropical weather, helping to improve forecasts. Here are some of them for your use. Descriptions of these data types are found farther down the page.</p><br>
<table>
<tr>
<td id="satellite">
<a href="satellite.html"></a>
</td>
<td id="radar">
<a href="radar.html"></a>
</td>
<td id="surface">
<a href="surface.html"></a>
</td>
</tr>
</table>
<br>
<table>
<tr>
<td id="models">
<a href="models.html"></a>
</td>
<td id="ocean">
<a href="ocean.html"></a>
</td>
<td id="upper">
<a href="upper.html"></a>
</td>
</tr>
</table>
</div>
</div> <!-- end wrapper -->
</body>
</html>

And here's the common CSS to all pages, which includes the styling of the banner:


body {
font-family: arial, sans, sans-serif;
font-size: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
background-image: url('images/wrapper-dropshadow.jpg');
background-position: center;
background-repeat: repeat-y;
}

#wrapper {
width: 1024px;
margin: 0 auto;
}

#banner {
background-image: url('images/banner.jpg');
width: 1024px;
height: 169px;
}

#navbar {
list-style-type: none;
margin: 0;
padding: 0;
position: relative; left: 200px; top: 110px;
}

#navbar li {
float: left;
margin-left: 5px;
background: rgb(0,106,205); /*Fallback for IE 8 and older*/
background-color: rgba(0,106,205,0.35);
border-radius: 12px;
-moz-border-radius: 12px; /*Support for older browsers*/
-webkit-border-radius: 12px;
}

#navbar a {
display: block;
padding: 13px 15px;
color: #FFF;
font-size: 1.2em;
}

#navbar a:link { text-decoration: none }

#navbar a:hover {
background: rgb(0,16,97); /*Fallback for IE 8 and older*/
background-color: rgba(0,16,97,0.35);
border-radius:12px;
-moz-border-radius: 12px; /*Support for older browsers*/
-webkit-border-radius: 12px;
}

#navbar #current-page {
background: rgb(0,16,97); /*Fallback for IE 8 and older*/
background-color: rgba(0,16,97,0.35);
}
/* -----End Styling of Banner and Navigation----- */

#main-section {
font-size: 0.8em;
padding: 20px;
}

FuquayDentist
08-13-2011, 11:19 PM
yes, check the margin and padding... should be 0

meridionaljet
08-14-2011, 12:59 AM
yes, check the margin and padding... should be 0

Of what? The banner? That's not even the issue, and I tried it anyway, but no effect. The element is moving outside of its div. That's not a margin issue.

meridionaljet
08-14-2011, 05:54 AM
I have found a post that details the same issue that I have. Apparently it has to do with odd-numbered pixel widths for the browser viewport when there is a vertical scrollbar. I have tested and seen that randomly resizing my browser window to even pixel widths will fix the problem, but for default maximized viewport widths of odd numbers, the problem exists. I can't think of a way to fix this without messing up the rendering for even-numbered viewport widths. For example, a 1px shift wouldn't work. Any suggestions?

http://www.sohtanaka.com/web-design/1px-background-alignment-bug/

Sammy12
08-14-2011, 06:09 AM
are you talking about the 1px of white space near the scrollbar to the right?

upload a live copy either to a server (there are free ones online if you dont have one yet). You can also just google 1px chrome bug.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum