/    Sign up×
Community /Pin to ProfileBookmark

Nav Bar Text Alignment

Hi,
My navbar seem to be out of alignment as each text on the button is of different length.

i have the navbar as follows:

[CODE].navbar {
width: 940px;
height: 25px;
font-family: verdana;
font-size:13px;
font-weight: bold;
background: url(../images/navB.jpg) repeat-x;
line-height: 25px;
padding-left: 20px;
}[/CODE]

How do I get the buttons to be spaced out evenly? ?

Thank you.

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@lockjs01Nov 18.2010 — Without looking at more of the code I would suggest assigning a Width value to your menu items.

so:

[CODE]
.nav .item {width:50px;}
[/CODE]
Copy linkTweet thisAlerts:
@myself1authorNov 18.2010 — The hover works fine, but some of the text is longer so it looks odd, if you know what I mean :o


.button a{

float: left;

width: 150px;

height: 25px;

color: #FFF;

text-decoration: none;

text-align:center;

}

.button a:hover {

float: left;

width: 150px;

height: 25px;

color: #000;

background: #FFF;

text-decoration: none;

text-align:center;

font-weight: bold;

background: #fff;

}[/QUOTE]
Copy linkTweet thisAlerts:
@lockjs01Nov 19.2010 — Assuming you mean you have the something like the following menu items:

[CODE]
<ul class="navbar">
<li class="button"=>Item 1</li>
<li class="button">my very long item</li>
<li class="button">Item 3</li>
</ul>
[/CODE]


so Item 1 and 3 now look odd as their container is too large in relation to the text, you could try removing the fixed width and applying a padding-left/right or margin-left/right value to the .button class. this would provide consistent spacing between the elements.

*note having as the bold :hover text is larger it will make the buttons wider as you hover over them.
Copy linkTweet thisAlerts:
@myself1authorNov 19.2010 — Assuming you mean you have the something like the following menu items:

[CODE]
<ul class="navbar">
<li class="button"=>Item 1</li>
<li class="button">my very long item</li>
<li class="button">Item 3</li>
</ul>
[/CODE]


so Item 1 and 3 now look odd as their container is too large in relation to the text, you could try removing the fixed width and applying a padding-left/right or margin-left/right value to the .button class. this would provide consistent spacing between the elements.

*note having as the bold :hover text is larger it will make the buttons wider as you hover over them.[/QUOTE]

Yes, that's the issue I'm having. OK, I will give that a try.

Thank you ?
×

Success!

Help @myself1 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...