Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place e / after every menu button?

Tags:

html

css

Ok, so I know there is a method of placing a " / " after every menu button by type it just once. I'm referring to this kind of menu.

Home / About / Portfolio.. so on ..

I know I could do it this way:

<li> <a href="#">Home /</a> </li>
<li> <a href="#">About /</a> </li>

But I want other way to do it.

Thanks!

like image 515
Julian Sethal Avatar asked Jun 16 '26 05:06

Julian Sethal


2 Answers

Demo

a:after{
    content: '/';
}

Avoid adding it to the last link, thanks Bjorn

li:last-child > a:after { 
    content: ''; 
}

Edit: it can be accomplish with one line too: Demo

li:not(:last-child) > a:after{
    content: '/';
}
like image 122
Juan Avatar answered Jun 19 '26 00:06

Juan


Demo

You may want a separator with borders:

li {
    list-style-type: none;
    border-right: 1px solid black;
    float: left;
    padding-right: 5px;
    margin-right: 5px;
}

li:last-child {
    border-right: none;
}

a {
    text-decoration: none;
    color: black;
}
like image 31
raviolicode Avatar answered Jun 18 '26 22:06

raviolicode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!