这里是我的按钮的设计(例如,不同的背景,缩放~1500%和实际尺寸)。我怎么能用单个元素和一些css3,或最少的额外元素呢? css大师,有人吗?
答案 0 :(得分:1)
HTML
<a href="#" class="button"></a>
CSS
.button {
position: relative;
z-index: 1;
display: block;
width: 22px;
height: 22px;
background: -webkit-linear-gradient(#f5f0ee, #e7ddd7);
background: -ms-linear-gradient(#f5f0ee, #e7ddd7);
background: -moz-linear-gradient(#f5f0ee, #e7ddd7);
background: linear-gradient(#f5f0ee, #e7ddd7);
border: 1px solid #c0b9b3;
border-radius: 3px;
box-shadow: inset 0px 1px #fcfbfb, 0px 1px rgba(0, 0, 0, 0.3);
}
.button:before {
content: "";
position: absolute;
left: -4px;
top: -4px;
z-index: -1;
padding: 4px;
width: 22px;
height: 22px;
background: -webkit-linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
background: -ms-linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
background: -moz-linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
background: linear-gradient(#f5f0ee, #e7ddd7);
border-radius: 3px;
box-shadow: 0px 1px rgba(255, 255, 255, 0.3);
}
我认为我唯一得不到的是渐变边框。