Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Frances Parkin
7,760 PointsSusy Navigation
I am trying to add some pipe (|) styling to my navigation.
My susy code is @include with-layout(6 inside, true){ @include span(1);
I have added &::before { content: " | "; }
but when I add &:first-child { &::before { content: " "; } }
it doesn't recognise that every instance of the navigation is not the first child - it sees all items in my html as first child. How do I fix this?
Also - any suggestions about how to make the pipe appear as a separator (ie in between susy navigation items) - I don't want to use a border-left because I want a subtle effect.
Thanks,
Victoria
1 Answer
Tim Knight
28,888 PointsFrances,
Why not give something like this a shot. It's not dependent on Susy, so just adjust it to your needs. Obviously my class name choice of pipe-separated is for demonstration purposes just to document the example, edit as appropriate.
.pipe-separated {
list-style: none;
margin: 0;
padding: 0;
li {
display: inline;
&::after { content: " | "; }
&:last-child::after { content: ""; }
}
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul class="pipe-separated" role="navigation">
<li><a href="">Nav Item</a></li>
<li><a href="">Nav Item</a></li>
<li><a href="">Nav Item</a></li>
<li><a href="">Nav Item</a></li>
<li><a href="">Nav Item</a></li>
</ul>
</body>
</html>