【发布时间】:2014-05-15 07:34:40
【问题描述】:
我正在css3中做一个div的渐变边框。到目前为止,我已经完成了这样的编码
在css中
.bot-left {
position: relative;
}
.bot-left:before, .bot-left:after {
content: "";
position: absolute;
bottom: -3px;
left: -3px;
}
.bot-left:before {
top: -3px;
width: 3px;
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000), to(transparent));
background-image: -webkit-linear-gradient(transparent, #000);
background-image: -moz-linear-gradient(transparent, #000);
background-image: -o-linear-gradient(transparent, #000);
}
.bot-left:after {
right: -3px;
height: 3px;
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#000), to(transparent));
background-image: -webkit-linear-gradient(left, #000, transparent);
background-image: -moz-linear-gradient(left, #000, transparent);
background-image: -o-linear-gradient(left, #000, transparent);
}
在html中
<div class="bot-left" style="width: 200px; height: 200px"></div>
但我仍然没有得到完全匹配的参考。渐变边框的参考图附上这个
更新 我希望背景颜色应该是透明的。
【问题讨论】:
-
codepen.io/gc-nomade/pen/HIJuL 没有背景颜色,但是不会看到白色上的白色,所以身体需要颜色