Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-28-2008, 11:14 AM   PM User | #1
Jon W
Regular Coder

 
Join Date: Jan 2008
Posts: 334
Thanks: 9
Thanked 0 Times in 0 Posts
Jon W is an unknown quantity at this point
Centering

#top_content_container {
background-color:#fff;
width:700px;
height:100px;
}

I want to center this on the page, how would I do this without using position?
Jon W is offline   Reply With Quote
Old 10-28-2008, 11:26 AM   PM User | #2
rangana
Senior Coder

 
rangana's Avatar
 
Join Date: Feb 2008
Location: Cebu City, Philippines
Posts: 1,752
Thanks: 65
Thanked 372 Times in 365 Posts
rangana will become famous soon enoughrangana will become famous soon enough
Code:
#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:auto;
}
Ensure you have a valid doctype to make it work on IE as well.

Hope that helps.
__________________
Learn how to javascript at 02geek

The more you learn, the more you'll realize there's much more to learn
Ray.ph
rangana is offline   Reply With Quote
Old 10-29-2008, 03:01 AM   PM User | #3
Jon W
Regular Coder

 
Join Date: Jan 2008
Posts: 334
Thanks: 9
Thanked 0 Times in 0 Posts
Jon W is an unknown quantity at this point
This doesn't seem to be doing the trick in my case. Maybe its something that I'm doing wrong?

body { background-image:url(/images/background5.gif);
margin-top:0px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
}

#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:auto;
}
Jon W is offline   Reply With Quote
Old 10-29-2008, 03:13 AM   PM User | #4
BoldUlysses
Regular Coder

 
BoldUlysses's Avatar
 
Join Date: Jan 2008
Location: Winston-Salem, NC
Posts: 938
Thanks: 10
Thanked 190 Times in 187 Posts
BoldUlysses is on a distinguished road
Give this a shot:

Code:
body { background-image:url(/images/background5.gif); 
width:100%;
text-align:center;
}

#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:0px auto;
}
__________________
matt | design | blog
BoldUlysses is offline   Reply With Quote
Old 10-29-2008, 03:19 AM   PM User | #5
Jon W
Regular Coder

 
Join Date: Jan 2008
Posts: 334
Thanks: 9
Thanked 0 Times in 0 Posts
Jon W is an unknown quantity at this point
Yes this works. Thanks again guys for you help.

Jon W
Jon W is offline   Reply With Quote
Old 10-29-2008, 08:21 AM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
body { background-image:url(/images/background5.gif);
width:100%;
text-align:center;
}
Quote:
Originally Posted by Jon W
Yes this works. Thanks again guys for you help.

Jon W
You are running in quirks mode! Add/change your doctype and switch your document in to a standard one.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:23 AM.


Advertisement
Log in to turn off these ads.