寻找薛定谔的猫

导航

 

使用background-clip属性实现透明边框

1 .bordertest {
2       border: 30px solid hsla(0,0%,90%,.5);
3       background: #bbb;
4       background-clip: padding-box;
5       width:500px;
6       height:300px;
7 }

查看运行效果

使用box-shadow模拟多重边框

 1 .bordertest1 {
 2       background: lightblue;
 3       box-shadow: 0 0 0 10px #000,
 4                   0 0 0 20px #888,
 5                   0 0 0 30px #aaa;
 6       width:300px;
 7       height:200px;
 8       position: absolute;
 9       top:100px;
10       left:100px;
11       padding: 10px;
12 }

使用outline属性生成多重边框

 1 .bordertest2{
 2      background: lightblue;
 3      border: 10px solid #000;
 4      outline: 10px dashed #888;
 5      width:300px;
 6      height:200px;
 7      position: absolute;
 8      top:100px;
 9      left:500px;
10      padding: 10px;
11 }

outline属性结合outline-offset属性的多重边框实现缝边效果

.bordertest3{
     background: lightblue;
     border: 15px solid lightblue;
     border-radius: 5px;
     outline: 3px dashed #fff;
     outline-offset: -10px;
     width:300px;
     height:200px;
     position: absolute;
     top:100px;
     left:900px;
     padding: 10px;
}

查看运行效果

posted on 2017-08-01 09:44  teagueli  阅读(9770)  评论(0编辑  收藏  举报