Vertical dividers on horizontal UL menu

前端 未结 8 509
情书的邮戳
情书的邮戳 2020-12-23 09:30

I\'m trying to create a horizontal navigation bar (no dropdown, just a horizontal list), but I\'m having trouble finding the best way to add vertical dividers between the me

8条回答
  •  无人及你
    2020-12-23 09:47

    This can also be done via CSS:pseudo-classes. Support isn't quite as wide and the answer above gives you the same result, but it's pure CSS-y =)

    .ULHMenu li { border-left: solid 2px black; }
    .ULHMenu li:first-child { border: 0px; }
    

    OR:

    .ULHMenu li { border-right: solid 2px black; }
    .ULHMenu li:last-child { border: 0px; }
    

    See: http://www.quirksmode.org/css/firstchild.html
    Or: http://www.w3schools.com/cssref/sel_firstchild.asp

提交回复
热议问题