0

我正在尝试仅使用一个元素来实现以下效果,我想删除包装器 div。

http://codepen.io/anon/pen/kdvex

通过使用嵌入的阴影和边框,我几乎达到了预期的效果。但是弯曲的边框看起来有点不对劲。看看蓝色位的边缘,看看我的意思。

http://codepen.io/anon/pen/uLKjl

有人可以改进吗?甚至可能吗?

4

2 回答 2

1

我添加了一个使用伪元素后模拟边框的元素。
http://codepen.io/anon/pen/FxemK

.btn.blue {
  z-index:2;
  position:relative
}

.btn.blue:after {content:"."; position: absolute; left:0; top:0; width:99.6%; height: 24px; background:none; z-index:1; border:2px solid white; 
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
-ms-border-radius: 7px;
-o-border-radius: 7px;
border-radius: 7px;}

第二个答案:http ://codepen.io/anon/pen/FxemK

.btn.blue {
  z-index:2;
  position:relative; line-height:100%;
}  



    .btn.blue:after {content:"."; position: absolute; left:0; top:0; 
  width:99.6%; background:none; z-index:1; border:2.2px solid white; 
  line-height:133%; 
    -webkit-border-radius: 7px;
    -moz-border-radius: 7px;
    -ms-border-radius: 7px;
    -o-border-radius: 7px;
    border-radius: 7px;}
于 2013-02-05T15:03:44.570 回答
1

跟进 Cadence96 对第二个边框使用伪选择器的建议:

http://codepen.io/anon/pen/zdcne

于 2013-02-05T15:36:05.923 回答