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 11-06-2011, 02:26 AM   PM User | #1
seer
New to the CF scene

 
Join Date: Nov 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
seer is an unknown quantity at this point
Div won't center

Hi! I'm working on my portfolio and have a problem...

The menubar won't get into the center! Check http://seer.se and see the column with "1, 2, 3, Hem, Sebastian, Kontakt". It should be just down under the header.

I think this problem is out of my knowledge since I really am an amateur at this so I would be so glad if someone could help me with it.

// S
seer is offline   Reply With Quote
Old 11-06-2011, 02:53 AM   PM User | #2
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 seer,
To center an element you need three things:
  1. a valid DocType
  2. an element with a width
  3. that elements right/left margins set to auto
Right now, your #header and #info are full width elements. #header is centered by the background properties you put on it.
#info might be centered like this:
Code:
#info {
background: #fff;
margin: 120px 0 0 -190px;
position:fixed;
height: 30px;
left: 50%;
}
This would work if you got #header and #info out of#content -
Code:
#wrapper {
clear:none;
margin: 0px auto;
padding: 0px;
width: auto;
height: 715px;
overflow: auto;
}
#info {
background: #fff;
display: table-row;
margin-top: 150px;
margin-left: auto;
margin-right: auto;
display: block;
width: 300px;
height: 30px;
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

Last edited by Excavator; 11-06-2011 at 03:03 AM..
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
seer (11-06-2011)
Old 11-06-2011, 04:17 PM   PM User | #3
seer
New to the CF scene

 
Join Date: Nov 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
seer is an unknown quantity at this point
Ah, allright! Thank you so much!
seer is offline   Reply With Quote
Reply

Bookmarks

Tags
align, center, div, menu

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 01:53 AM.


Advertisement
Log in to turn off these ads.