Skip to main content
Participating Frequently
November 30, 2014
Question

How do I add vertical lines between navigation labels ?

  • November 30, 2014
  • 3 replies
  • 17268 views

This is prob a very simple solution, however I never done it before, How would I be able to add Vertical lines between navigation labels. I tried to use Photoshop and save a line to a png but I'm sure there is a proper way to this solution. As always help would be appreciated.


Home|About|Contact| 

This topic has been closed for replies.

3 replies

Participant
November 30, 2014

I do not know if this is what you are asking but if you wish to add the vertical "|" in a HTML document simply use &#124 this will display the vertical pipe  that you wish to use. For a list of special characters here is a good resource for you

HTML Codes - Table of ascii characters and symbols

Ken_Binney
Inspiring
November 30, 2014

Or simply type the uppercase "pipe" keystroke between your links

Nancy OShea
Community Expert
Community Expert
November 30, 2014

Use CSS border-right property.

nav ul {

    margin: 0;

    padding: 0

}

nav li {

    list-style: none;

    font-size: 12px;

    float: left;

    text-align: center;

}

nav li a {

    display: block;

    text-decoration: none;

    margin-right: 0;   /* space between links */

    width: auto;   /* adjust width as needed or use auto */

    padding: 6px;

    font-weight: bold;

    line-height: 2em;

    color:#1e5799;

    border-right: 1px solid #000;

}

/**remove from last item**/

nav li:last-child a {

    border:none;

}

/**float clearing**/

nav:after {

     content: '';

     clear:left;

     display:block;

}

HTML:

<nav>

     <ul>

          <li><a href="index.html">Home</a></li>

          <li><a href="about.html">About</a></li>

          <li><a href="contact.html">Contact</a></li>

     </ul>

</nav>

Nancy O.

Nancy O'Shea— Product User & Community Expert
raiden92Author
Participating Frequently
November 30, 2014

I want the vertical line to go from top to bottom of the blue navigation bar

This is my CSS code

.Fbicon{

  background:url(../images/fbicon.png);

  width: 24px;

  height: 24px;

  float: right;

  margin-top:17px;

  border-right: 1px solid #fff;

}

Participant
November 30, 2014

The css for the icon is based on the dimensions of the icon. You could make a separate "|" to match the size of the nav  and position it after the fb icon.