格砸3206448
2016-04-16 01:34
.nav li::before, .nav li::after{ content:"";/*在li之间插入空内容*/ position:absolute;/*相对于li标签*/ /*定位分割线的位置大小*/ top:14px; height: 25px; width: 1px; } .nav li::after{ right: 0px; 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)); }
只有部分渐变是因为.nav li::after里面设置了height 和width;
background: linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,.2) 50%, rgba(255,255,255,0));
意思是透明度为0的白色向上渐变为透明度为0.2的白色,再向上渐变为透明度为1的白色,其中中间临界点为50%;
十天精通CSS3
242555 学习 · 2623 问题
相似问题