2012-08-07 171 views

回答

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); 
} 

JSFiddle

我認爲唯一不能得到的是漸變邊界。

+0

非常感謝,它很酷!我認爲我可以使用:之前/之後模擬內部跨度和modernizr後備與實際跨度爲舊版瀏覽器,嗯? – user1581655 2012-08-07 14:34:05

+0

nope,它與href文本重疊... – user1581655 2012-08-07 14:58:33

+0

是的,我討厭自己額外的標籤,但我無法擺脫它。我會繼續嘗試。 – depa 2012-08-07 15:12:03