|
Small centering issue...please help!
01-27-2010, 11:04 AM
|
Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Ok, in my sig, the site SearchBliss Web Tools has a top navbar (blue with white links). I want the links centered and I can't get it ti work. The problem is I am currently using padding which looks fine in FF and Opera, but is too far left on IE...so how can I center it so it looks good on all browsers?
Here id the CSS section in question:
Code:
#menu{
width:950px;
height:60px;
margin:0 auto;
background:#6AA2FD url(images/img04.gif);
}
#menu a{
display:block;
float:left;
padding:18px 14px 0 14px;
text-decoration:none;
font-size:1.5em;
font-weight:bold;
color:#FFFFFF;
}
I bolded the section that I'd need to change to get it to center. margin:0 auto didn't work, and text-align:center didn't either???
Any suggestions would be great?
Thanks!
|
|
|
|
01-27-2010, 11:09 AM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
You can't float and center at the same time AND unless it has a fixed width it will be as wide as the content. (so you it will be "text-align:center" but you can't tell)
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-27-2010, 11:19 AM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by chrishirst
You can't float and center at the same time AND unless it has a fixed width it will be as wide as the content. (so you it will be "text-align:center" but you can't tell)
|
Rganks Chris, but when I remove the float:left and add "text-align:center", I get the menu links centered on top of each other instead of left to right...grrrrr. This is making me nuts!
|
|
|
|
01-27-2010, 12:05 PM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
float them AND set a fixed width with text-align: center.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-27-2010, 01:06 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by kline11
Rganks Chris, but when I remove the float:left and add "text-align:center", I get the menu links centered on top of each other instead of left to right...grrrrr. This is making me nuts!
|
It's stll stacking them...I must be missing something. I already have a fixed width in this section:
Code:
#menu{
width:950px;
height:60px;
margin:0 auto;
background:#6AA2FD url(images/img04.gif);
}
What am I missing?
Thanks Chris.
|
|
|
|
01-27-2010, 01:24 PM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
Aye but you then set the <a>nchor element to be display:block;
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-27-2010, 01:40 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by kline11
It's stll stacking them...I must be missing something. I already have a fixed width in this section:
Code:
#menu{
width:950px;
height:60px;
margin:0 auto;
background:#6AA2FD url(images/img04.gif);
}
What am I missing?
Thanks Chris.
|
OK, here is what I have now, and it looks the same as it did before:
Code:
#menu a{
text-align:center;
float:left;
padding:18px 14px 0 14px;
text-decoration:none;
font-size:1.5em;
font-weight:bold;
color:#FFFFFF;
}
I tried removing the padding, that was worse. I really stink as CSS!
Thanks Chris,
John
|
|
|
|
01-27-2010, 02:54 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
This must be possible, right?!? Arrrg!
|
|
|
|
01-27-2010, 03:02 PM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
#menu a{
text-align:center;
display:block;
width:nn em|%|px|pt|ex
float:left;
padding:18px 14px 0 14px;
text-decoration:none;
font-size:1.5em;
font-weight:bold;
color:#FFFFFF;
}
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-27-2010, 03:20 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
OK, here is what I have and NO change???
#menu a{
text-align:center;
display:block;
width:950px;
float:left;
padding:18px 14px 0 14px;
text-decoration:none;
font-size:1.5em;
font-weight:bold;
color:#FFFFFF;
}
What a PITA! I really appreciate your help Chris.
|
|
|
|
01-27-2010, 03:25 PM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
But at 950 px it will be the width of the page, so that negates the float 
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-27-2010, 03:33 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by chrishirst
But at 950 px it will be the width of the page, so that negates the float 
|
It doesn't seem to matter what the pixels are, 950, 500, or 200, it just stacks them on top of each other instead of left to right???
|
|
|
|
01-27-2010, 08:44 PM
|
Re: Small centering issue...please help!
|
Posts: 29
Name: Simon
|
Her John
There are two ways i solve my coding problems, Firstly, add borders to the individual areas you are trying to fix, using a different colour for each one (in this case, the UL LI A and even DIV elements in your CSS file would have a different coloured 1px solid border.
This helps to show me where the problem lies. If that doesnt work, search the web for an example/tutorial that does do what i want, and then manipulate the code with my own values until it's padding, colours etc match what i want.
Below is what i was using on my main site a little while back.
#nav, #nav ul
{
background-color:#fff;
color:#000;
margin:0;
padding:0;
list-style:none;
}
#nav li
{
background-color:#fff;
color:#000;
float:left;
padding:0 1px 0 0;
}
#nav li a
{
background-color:#ccc;
display:block;
padding:5px;
}
__________________
ZAM Howto - simple, straight forward answers on how to get started with a website.
Please login or register to view this content. Registration is FREE
|
|
|
|
01-28-2010, 11:15 AM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Thanks,
I believe I found a solution and it looks good in IE and FF, however I cannoy test it in IE8 or Opera. If you or anyone else could take a look, that would be a help. Thqnks again Chris and solvision!
|
|
|
|
01-28-2010, 11:21 AM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
IE8 Ok, Opera 9.6 Ok, Opera 10 Ok
I can check earlier versions when I fire another machine up, probably not today though 
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-28-2010, 11:33 AM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by chrishirst
IE8 Ok, Opera 9.6 Ok, Opera 10 Ok
I can check earlier versions when I fire another machine up, probably not today though 
|
Thanks Chris! I can't send you Talkapation until I "spread more around". I'd buy you a beer if I lived in the UK (You don't want an Ameriscan beer - we can't do it right). If you have a PayPal account, PM me the email and I send you a little "beer money". 
|
|
|
|
01-28-2010, 11:43 AM
|
Re: Small centering issue...please help!
|
Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
|
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
01-28-2010, 12:06 PM
|
Re: Small centering issue...please help!
|
Posts: 1,788
Name: John
Location: USA
|
Quote:
Originally Posted by chrishirst
|
Sir, I have plenty of shame.
I wish I could get a "real" beer like I did many years back in London...with real foam, and room temprature the way beer was ment to be made...NOT cold. But since I can't, I would love to "send" you a beer as long as you drink it in my honor. PayPal email please. 
|
|
|
|
|
« Reply to Small centering issue...please help!
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
|