View Full Version : Big background - 1px problem

02-22-2009, 01:52 PM

I'm loosing my head with one problem. I've got this design:


The problem is that main content div is shifted 1px to the left in Opera, while in FF everything looks fine. I've been strugling with that problem couple of hours, and I have no explanation about it. The problem also appears in IE but only then I change the size of the window. In maximize browser it looks fine (except Opera). I've checked it with any available developer tool.

The difference is:



Can anybody help me please?

02-22-2009, 03:50 PM
Have you tried resizing the browser window in Firefox and Opera, too? You may notice a 1px shift for every other pixel of resizing. This is probably a rounding issue with your images/content width. If you resize the window by two pixels the browser has to shift the content by one pixel to keep it in place. Now different browsers decide differently when to move it. Some browsers move it with the first pixel of resizing, some move it with the second pixel. And some browsers even move different content differently, relative to the place that content is positioned in. So, you should play with the containers that contain the images and rearrange things as necessary.

02-22-2009, 06:31 PM
Hello gooddhost,
I gave your text div an id and removed the inline styles like this -

<div class="main_content_header"></div>

<div id="text">
<h1>Informacje o nas</h1><br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam condimentum tempor diam. In hac habitasse platea dictumst.

And then changed a few things in your CSS like this

* {
padding: 0;
margin: 0;
border: none;

font-family: Tahoma, Arial, Verdana, sans-serif;
font-size: 11px;
color: #83b4d4;
background: #064272 url('img/header.jpg') no-repeat center top;
width: 100%;

#container {

#inner_container {
width: 913px;
margin: 0 auto;
padding: 0 0 0 37px;
/*background: #ccc;for testing*/
overflow: auto; /*to clear the floats*/

#header {
padding:0 0 0px;
height: 262px;

#logo {
position: relative;
top: 10px;
left: 20px;
width: 204px;
height: 46px;

#my_navigation {
position: relative;
top: -30px;
left: 300px;
width: 500px;

#my_navigation ul {

list-style-type: none;


#my_navigation li {
float: left;
list-style-type: none;
margin: 0 10px 0 0;

#my_content {
width: 672px;
text-align: justify;
min-height: 500px;

#my_content h1 {
font-family: "Trebuchet MS", Verdana, Tahoma, Arial, sans-serif;
color: #fff;
font-size: 25px;
font-weight: normal;

#text {
margin: -81px 0 0;
padding: 0pt 20px;
line-height: 18px;
width: 632px;

#realtive_bg {
position: relative;
top: 81px;

#cont {
margin: 0px 0 0 0;

#main_content {
width: 672px;
background: url('img/content_bg.jpg') repeat-y;

.main_content_header {
background: url('img/content_header.jpg') no-repeat top left;
width: 672px;
height: 81px;

.main_content_footer {
background: url('img/content_footer.gif') no-repeat top left;
width: 672px;
height: 6px;

#my_breadcrumb {
padding:0 0 0px 0px;
margin:0 0 30px 30px;

#my_breadcrumb a {
color: #8cafc7;

#my_sidebar_left {
float: left;
padding: 100px 0 0 9px;
width: 219px;

#my_sidebar_left .inner {
background: url('img/aktualnosci_bg.gif') repeat-y top left;

#footer {
clear: both;
background: #064272 url('img/footer.png') no-repeat center top;
height: 169px;
margin: auto;

It's working in FF3, it resizes without showing your 1px jog now. Too many changes made to point out - I usually highlight them in red but...
You'll just have to compare the original CSS to the new to see it. The margin:0 0 0 37px; in #inner_container was the final cure but some other things had to be changed before that would work.

Read about clearing your floats here (http://www.quirksmode.org/css/clearing.html). Very important!