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

 
Join Date: Jan 2013
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
brookfloyd is an unknown quantity at this point
Cannot get the first/last-child to work on my nav menu.

I am developing a site at http://mixnob.mybigcommerce.com/ and have run into a snag on my top navigation bar with my main category links. I am not a pro with css but can hack my way around pretty well. I know about the first and last child tags and know about using the first-child first if possible because of better compatibility. But for whatever reason I cannot get it to work to only shut off the first border-left. It shuts off all of them instead. Any help would be appreciated.

Here's some of the code.

HTML

<div id="HeaderUpper">
<div id="HeaderLower">
<div id="SideCategoryList" class="CategoryList">
<h2>Categories</h2>
<div class="SideCategoryListFlyout">
<ul class="sf-menu sf-vertical sf-js-enabled">
<li>
<a href="http://mixnob.mybigcommerce.com/home/">Home</a>
</li>
<li>
<a href="http://mixnob.mybigcommerce.com/virtual-instruments/">Virtual Instruments</a>
</li>
<li>
<a href="http://mixnob.mybigcommerce.com/plugins/">Plugins</a>
</li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
</ul>

CSS

#SideCategoryList li, #SideCategoryList .sf-menu li {
}
#SideCategoryList li:first-child {
border-left: 0 none;
}
#SideCategoryList li, #SideCategoryList .sf-menu li {
float: left !important;
list-style: none outside none;
margin: 0;
padding: 0;
position: relative;
width: auto !important;
}
#SideCategoryList li, #SideCategoryList .sf-menu li {
}
#SideCategoryList li, #SideCategoryList .sf-menu li {
float: left !important;
list-style: none outside none;
margin: 0;
padding: 0;
position: relative;
width: auto !important;
}
h1, h2, h3, .TitleHeading, .slide-text, #HeaderLower li, .ProductActionAdd, .ProductDetailsGrid .DetailRow.PriceRow .Value, .QuickViewBtn, .btn {
font-family: Arial,Verdana,Helvetica,Sans-serif;
}
.sf-vertical, .sf-vertical li {
width: 10em;
}
.sf-menu li {
float: left;
position: relative;
brookfloyd is offline   Reply With Quote
Old 01-04-2013, 03:55 PM   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 brookfloyd,
Try it like this -
Code:
#SideCategoryList li a, #SideCategoryList .sf-menu li a {
    /*border-left: 1px solid #FFFFFF;*/
    color: #FFFFFF;
    display: block;
    font: 16px Arial,Verdana,Helvetica,Sans-serif;
    padding: 8px 0 9px 30px;
    text-decoration: none;
}
#SideCategoryList li {border-left: 1px solid #fff;}
#SideCategoryList li:first-child {border-left: none;}

...
It kind of looks like you were putting two borders on your li's with this
Code:
#SideCategoryList li, #SideCategoryList .sf-menu li {
}
If that's the case, the CSS you had in place for removing the border on the :first-child removed only one border and did not remove the border off #SideCategoryList .sf-menu li



...
When posting code in the forum, please use the code tags, - available with the # button in the post edit window.
This will wrap your code in a scroll box which greatly helps the readability of your post.
__________________
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
Users who have thanked Excavator for this post:
brookfloyd (01-22-2013)
Reply

Bookmarks

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 11:57 PM.


Advertisement
Log in to turn off these ads.