Solved

Adding a partial border on list item but not on the first element

Posted on 2014-02-18
8
243 Views
Last Modified: 2014-02-18
Hi experts,
I have a top menu bar created with a list and I want separators made of a partial border.
So far I have this:
#TopLinks .nav > li > a:after{content:""; background: #a8a8a8; position: absolute; bottom: 5px; left: 0; height: 50%; width: 1px;}
This is working great, but I don't want the first element to have a border.
I've tried combined (not)first-child with the previous style, but I can't make it work.

That's what I have so far with the style above:
 topbarYou can see that the first element has a border on the left, which I don't want.
Any help appreciated, thanks.
0
Comment
Question by:hqdev
  • 3
  • 3
  • 2
8 Comments
 
LVL 18

Accepted Solution

by:
ChetOS82 earned 500 total points
ID: 39867562
#TopLinks .nav > li:first-child > a:after{width:0px;}
0
 
LVL 58

Expert Comment

by:Gary
ID: 39867565
#TopLinks .nav > li > a:not(:first-child):after{...}
0
 
LVL 18

Expert Comment

by:ChetOS82
ID: 39867578
My only concern with :not is that it isn't supported on IE8 or earlier.
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

Author Comment

by:hqdev
ID: 39867589
ChetOS82, this is working!
Sorry Cathal, but this is not working.
0
 

Author Comment

by:hqdev
ID: 39867597
It's for an intranet, so we are in control of browsers and we will use only the latest, it's ok, if it's not IE8 compatible.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39867629
Yeah it should have been

#TopLinks .nav > li:not(:first-child) > a:after

If you are still writing code to support IE8 you need a reality check
0
 

Author Comment

by:hqdev
ID: 39867642
Just for fun, I've tested your last entry Cathal and it's working, sorry I've already close the case.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39867651
NP, accepted solution is perfectly valid.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
alert before form submission 6 40
Remove third quote mark from widget 6 23
Zoom the page when you go in from your phone 3 54
Change of column alignment in div 2 18
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question