Latchy
06-30-2010, 11:15 PM
Hi,
I am designing a website/demo page and have a div for the content to go into, only problem is. It wont center, I have tried everything from margin, padding, align. Can you help me please?
Here is the link...
http://www.graphiccentral.org/demopage-h10.htm
Thanks,
Rob
Brucey2010
06-30-2010, 11:30 PM
Can you not give the DIV a width.
#contentdiv{
background-color:#C3C3C3;
top: 80px
width: 700px; */or whatever/*
margin-left: auto;
margin-right: auto;
}
I should have mentioned that by giving it a width you should be able to use margin-left margin-right auto to center it.
Brucey.
Donkey
07-01-2010, 01:28 AM
Youv'e got #contentdiv in twice
#contentdiv {
top: 80px;
background-color: #c3c3c3;#
width: 70%;
}
then
#contentdiv {
margin:0 auto;
width: 85%;
text-align: left;
position: fixed;
top: 130px;
background-color: #FFFEC9;
border: 1px solid #FADF8E;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-khtml-border-radius: 6px;
}
The second one overrides the first
try this instead:
#contentdiv {
margin:130px auto 0 auto;
width: 85%;
text-align: left;
background-color: #FFFEC9;
border: 1px solid #FADF8E;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-khtml-border-radius: 6px;
}
Also you have your universal resets in the wrong place
* {
padding: 0;
margin: 0;
}
Should be the first line in your style sheet.