Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Couple Nav Bar Questions
Old 08-06-2009, 08:17 PM Couple Nav Bar Questions
Experienced Talker

Posts: 43
Name: Jon
Trades: 0
I have a very basic horizontal Nav bar and can't figure out two things.

1. I put a border-right 1px on each item so that I can have a simple separator. I obviously don't want the last item to have a border right 1px.

How can I get rid of it? I tried creating an id in the <li> to have "border-right: none; - but that didn't work.

2. How can I increase the clickable area for each nav bar item? Currently, only the nav bar item is clickable but I would like the surrounding "box" area to be clickable.
Foppa is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-06-2009, 10:01 PM Re: Couple Nav Bar Questions
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Quote:
1. I put a border-right 1px on each item so that I can have a simple separator. I obviously don't want the last item to have a border right 1px.
Create a class in your css and call it something like .last with border-right: none, then add that class to the last menu item.
Quote:
How can I increase the clickable area for each nav bar item?
Put display:block on the <a> inside the list item.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-06-2009, 10:38 PM Re: Couple Nav Bar Questions
Experienced Talker

Posts: 43
Name: Jon
Trades: 0
What's the proper/best way to add the .last class to the last menu item?

I tried surrounding it by a <div> and also tried putting it in the <li> but they didn't work.


Quote:
Originally Posted by LadynRed View Post
Put display:block on the <a> inside the list item.
I didn't understand this completely. I tried messing with display:block but nothing turned out right.


Here is my Nav bar code:

html
Code:
<div id="nav">
        <ul>
            <li><a href="">Item 1</a></li>
            <li><a href="">Item 2</a></li>
            <li><a href="">Item 3</a></li>
            <li><a href="">Item 4</a></li>
            <li><a href="">item 5</a></li>
            <li><a href="">Item 6</a></li>
        </ul>
    </div>
css
Code:
#nav ul{
    background-color:#669933;
    width:780px;
    display:block;
    margin: 0px 0px 0px 0px;
    height:24px;
    padding:5px 0px 0px 0px;
    text-align:center;
    line-height: 1.4em;
    font-size: 13px;
    font-weight: bold;
}
#nav li{
    display:inline;    
    border-right-width: 1px;
    border-right-style: solid;
    border-right-color: #E1E1E1;
}
#nav ul a{
    text-decoration:none;
    color:#FFFFFF;
    margin: 0px 14px;
}
#nav ul a:hover{
    text-decoration:none;
    color:#F5E412;
}
Foppa is offline
Reply With Quote
View Public Profile
 
Old 08-07-2009, 12:16 PM Re: Couple Nav Bar Questions
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
like this:
Quote:
<li class="last"><a href="">Item 6</a></li>
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-08-2009, 05:07 AM Re: Couple Nav Bar Questions
Experienced Talker

Posts: 43
Name: Jon
Trades: 0
Quote:
Originally Posted by LadynRed View Post
like this:
Hmm, I don't get what's wrong. It's still not working. I put it exactly how you have it.
Foppa is offline
Reply With Quote
View Public Profile
 
Old 08-08-2009, 03:12 PM Re: Couple Nav Bar Questions
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
How is it in your CSS ?
Should be something like this:

#nav li.last{border-right: none;}
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 03:33 AM Re: Couple Nav Bar Questions
Experienced Talker

Posts: 43
Name: Jon
Trades: 0
Thanks! That worked. I had it wrong, I only put: .last {border-right; none;}

I'm confused as to why I needed the #nav in there. Is this because it within the #nav id div?

It also worked fine with just: #nav .last {border-right; none;}

Is one more correct than the other?
Foppa is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 11:49 AM Re: Couple Nav Bar Questions
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Quote:
I'm confused as to why I needed the #nav in there. Is this because it within the #nav id div?
The reason it worked is SPECIFICITY - adding the div declaration made application of the class more specific. Same for the #nav .last - means that the class ONLY applies to elements inside of #nav.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 05:35 PM Re: Couple Nav Bar Questions
Experienced Talker

Posts: 43
Name: Jon
Trades: 0
Great, I see, thanks for all the help.
Foppa is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Couple Nav Bar Questions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27877 seconds with 12 queries