Forum Moderators: not2easy

Message Too Old, No Replies

centring a background

         

jasonwade

6:05 pm on Mar 23, 2008 (gmt 0)

10+ Year Member



Ok, so I always centre the content of my websites using a centered div, normally no problem, only now I wanted to centre a background and have it repeat only down. In a 1024x768 resolution everything looks fine (cause the layout and background are exactly the right size for that), but in bigger resolutions though the background jumps 1 pixel to the right, anything that I could be doing wrong?

This is the start of my header.inc file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<HEAD>

<TITLE>Nickalicious</TITLE>

<link rel="stylesheet" href="/newlayout/colors.css" type="text/css" />

<style type="text/css">

#centered
{
width:1004px;
margin:0 auto; /* to center the div */
text-align:justify; /* restore the body alignment */
position:relative; /* because of "relative/absolute" content inside the div */
}

body{
background:#f6f6f6;
background-image: url('bg.jpg');
background-repeat: repeat-y;
background-position: center;
spacing:0px;
margin-top:0px;
margin-bottom:0px;
}

</style>

Xapti

6:17 pm on Mar 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One has to assume thing if they have CSS code without the HTML it styles.
You may want to try using a universal reset (*{margin:0 padding:0}), but it seems unlikely that would do anything.
How do you know that it's one pixel off in the first place though? and how come that's a problem?

jasonwade

6:20 pm on Mar 23, 2008 (gmt 0)

10+ Year Member



Cause the webmiss (I'm just a co-webmiss) has a bigger resolution herself and it doesn't really look very nice...

And uhm I'm not very smart with these things, what do you mean with "one has to assume....it styles"?

swa66

7:39 pm on Mar 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's "spacing:0px;" supposed to do ?
(it means the CSS doesn't validate)

Xapti is asking for a bit more (sanitized!) html AFAIK.