Question

I am trying to add a / after my lil elements in my menu as a menu divider - using Bootstrap as a base.

The code can be found here: http://jsfiddle.net/zBxAB/1/

As you can see the slash is wrapping to the next line, I have tried to resolve this using inline-block which isn't working.

Is it possible to fix?

(I can get the same working by selecting the anchor tag but would rather not if possible.)

Thanks

HTML:

<nav class="navbar nav-main">
                    <div class="navbar-inner">
                        <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                            <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar">
                            </span>
                        </button>
                        <div class="nav-collapse">
                            <ul class="nav nav-pills"> <li class="portfolio"><a href=#o">Portfolio</a></li><li class="contact-me"><a href="#">Contact Me!</a></li><li class="last from-the-blog"><a href="#">From the Blog</a></li>
                            </ul>
                        </div>
                    </div>
                </nav>

CSS:

.navbar .nav > li {
    display: inline-block;
}

.navbar li:after {
   content: "/"; 
   display: inline-block;   
}

.navbar li:last-child:after {
    content: "";
}
Was it helpful?

Solution

I don't know if it's the BEST way, but it's possible to do with absolute positioning.

.navbar .nav > li {
    display: inline-block;
    position: relative;
}

.navbar li:after {
   content: "/"; 
   display: inline-block; 
   height: 12px;
   width: 6px;
   position: absolute;
   right: 0;
   top: 8px;  
}

.navbar li:last-child:after {
    content: "";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top