...

View Full Version : Help with layout alignment



Mfx
03-06-2009, 04:52 PM
Hi im currently working in this layout (http://evannalynchfans.com/layouttest/), I'm a beginner using dreamweaver, the problem is that the layout is aligned to the right when I want it in the middle, could someone tell me the code to put it in the center.

jcdevelopment
03-06-2009, 05:26 PM
There will need to be alot of work done. You could simply go in and create a wrapper and center it. then enclose the div around all of the content like so


.wrapper {
width:800px;
margin:0 auto;
}

then it would center.. but unfortunately almost all of your images are positioned using absolute positioning... which you would need to get rid of all of that in ourder to get it to center.

I hope this helped a little.

Mfx
03-06-2009, 05:38 PM
Ok I've posted an ad for someone to do it. Thanks anyway.

Excavator
03-06-2009, 05:50 PM
Hello Mfx,
The easiest way to center things needs:

DocType
width of the container
container's left/right margins set to auto


What's messing yours up is some odd CSS and some of your absolute positioning. See http://www.tyssendesign.com.au/articles/css/absolute-positioning-pitfalls/

We can center your containing div by fixing this line in red -
#centered
{
width: 1119px;
margin: 0 auto;
text-align: justify;
position: relative;
}
If you resize your browser you can see now that your you bg.gif doesn't line up.
Typically a background be the background of the container it was made for, like this -

body {
background: #D5D5D5;
text-align: center; /* for IE */
margin: 5px;
font: 12px/15px trebuchet ms;
color: #575757;
}

#centered {
width: 1119px;
margin: 0 auto; /* to center the div */
text-align: justify; /* restore the body alignment */
position: relative;
background: url(bg.gif) repeat-y;
}

But, again, the absolute positioning is messing with it.

You should have a look at the links in my sig about validation.

...

And finally, to center your page. This is really not the normal way to do it. I've shown you how it should be done and why that's not working for you but, since fixing it would require a total re-write, ...this works here locally in FireFox -

body {
background: #D5D5D5 url(bg.gif) repeat-y center;
text-align: center; /* for IE */
font: 12px/15px trebuchet ms;
color: #575757;
}

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum