css 边框渐变色


如上图所示,用border实现边框的渐变:

  先给div添加右边框(或者左边框),

border-right: 1px solid #ddd;

  用border-image设置渐变

border-image: -webkit-linear-gradient(#fff, #000) 20 20;

完整的写法:

 <!-- HTML -->
<view class='content'>
   <view>
      <image src='1.jpg'></image>
      <view>首页</view>
   </view>
   <view>
      <image src='2.jpg'></image>
      <view>关于</view>
   </view>
   <view>
      <image src='3.jpg'></image>
      <view>成果</view>
   </view>
</view>
.content {
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
}
.content > view {
  flex-grow: 1;
  border-right: 1px solid #ddd;
  border-image: -webkit-linear-gradient(#fff, #000) 20 20;
}

border-image的各个参数详细解析:http://web.jobbole.com/88773/

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM