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 03-07-2013, 04:18 PM   PM User | #1
evilgandhi
New Coder

 
Join Date: Aug 2011
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
evilgandhi is an unknown quantity at this point
centering (the usual)

hello peoples,

as usual its the old centering issue that (for me anyway) plagues my website design life......

i'm trying to center the contact info box on this page.....

http://gandhiproductions.herobo.com/...4/contact.html

it need to be dynamic, so it stays centered if the window is resized....

i've tried finding info on the net about this but nothing works....

help anyone.... any help?

thank you

Gandhi
evilgandhi is offline   Reply With Quote
Old 03-07-2013, 04:27 PM   PM User | #2
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 906
Thanks: 4
Thanked 212 Times in 211 Posts
tracknut is an unknown quantity at this point
To center an object, it needs a width (presumably smaller than the object it's being centered within), it needs auto left and right margins, and the document needs a doctype. The only thing you're missing is the auto margins.

Dave
tracknut is offline   Reply With Quote
Old 03-07-2013, 05:10 PM   PM User | #3
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello evilgandhi,
You have more than just a centering problem. You have some divitis there, you don't follow the box model and you float a full width element. Look at these changes to your CSS -
Code:
#centercontactbox{
		/*height:270px;
	width:400px;*/
width: 410px;
margin: 0 auto;
clear: both;}

#contactbox{
	/*height:270px;
	float:left;*/
	width:400px;
	padding:5px;
overflow: auto;
	background:#6194aa;
	text-align:center;
}
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Tags
center

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 06:32 PM.


Advertisement
Log in to turn off these ads.