Vertical dividers on horizontal UL menu

前端 未结 8 479
情书的邮戳
情书的邮戳 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:49

    This works fine for me:

    NB I'm using BEM/OCSS SCSS Syntax

    #navigation{
      li{
         &:after{
            content: '|'; // use content for box-sizing
            text-indent: -999999px; // Hide the content
            display: block;
            float: right; // Position
            width: 1px;
            height: 100%; // The 100% of parent (li)
            background: black; // The color
            margin: {
              left: 5px;
              right: 5px;
            }
          }
    
          &:last-child{
    
            &:after{
              content: none;
            }
    
          }
      }
    }
    

提交回复
热议问题