代码实现导航栏分割线

无需背景图片就可以实现导航栏分割线,颜色自定,线段虚实自定。

 

    .nav1{
              width:auto;
              height:50px;
              text-align:center;
              margin:13px auto 0;
            }
            .nav1 a{
              display: inline-block;
     text-decoration:none;
          }
            .nav1 a:hover{
          color:#09109e;
    border:6px none #fff;
   font-weight:bold;
  
            }
  
            .nav1 li{
              position:relative;
            }
       /*制作导航分隔线效果*/
            .nav1 li::before,
            .nav1 li::after{
              content:"";
              position:absolute;
              top:-5px;
              height: 40px;
              width: 1px;
            }
            .nav1 li::after{
              right: 0;
              background: -moz-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%,
rgba(255,255,255,0));
              background: -webkit-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%,
rgba(255,255,255,0));
              background: -o-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%, rgba
(255,255,255,0));
              background: -ms-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%, rgba
(255,255,255,0));
              background: linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%, rgba
(255,255,255,0));
            }
            .nav1 li::before{
              left: 0;
              background: -moz-linear-gradient(top, #2580d9, #c4dff5, #2580d9, #c4dff5, #2580d9,#c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9);
              background: -webkit-linear-gradient(top, #2580d9, #c4dff5, #2580d9, #c4dff5, #2580d9,#c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9);
              background: -o-linear-gradient(top, #2580d9, #c4dff5, #2580d9, #c4dff5, #2580d9,#c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9);
              background: -ms-linear-gradient(top, #2580d9, #c4dff5, #2580d9, #c4dff5, #2580d9,#c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9);
              background: linear-gradient(top, #2580d9, #c4dff5, #2580d9, #c4dff5, #2580d9,#c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9, #c4dff5,#2580d9);
            }
            /*删除导航第一个和最后一个分隔线*/ 
     .nav1 li:first-child::before{
                display: none;
                }
      .nav1 li:last-child::after{
              display: none;
            }

转载于:https://www.cnblogs.com/Man-Dream-Necessary/p/4858689.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值