2012-12-24 43 views
1

我創建了這個用於網站按鈕的png圖片。問題是,必須多次使用png圖片,這會增加網絡流量。我想在CSS中創建相同的圖片並將其用作按鈕。你能幫忙在css中創建這個按鈕嗎?如何在css中創建這個圖像按鈕?

enter image description here

+0

http://www.cssbuttongenerator.com/ – Vucko

+0

[**在線CSS按鈕發生器**](https://開頭WWW .google.com /查詢q = CSS +按鈕+發生器)。提醒:如果在非現代瀏覽器上使用CSS3,與使用圖像文件不同,會出現後備圖形。 – arttronics

回答

3

如果您使用的是相同的圖像文件,在幾個地方,它僅被下載一次。

話雖這麼說,這個按鈕很容易在CSS做:

<input type="submit" class="button" value="New Router" /> 

.button { 
    background: #eeeeee; /* Old browsers */ 
    background: -moz-linear-gradient(top, #eeeeee 0%, #b4b4b4 100%); /* FF3.6+ */ 
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#b4b4b4)); /* Chrome,Safari4+ */ 
    background: -webkit-linear-gradient(top, #eeeeee 0%,#b4b4b4 100%); /* Chrome10+,Safari5.1+ */ 
    background: -o-linear-gradient(top, #eeeeee 0%,#b4b4b4 100%); /* Opera 11.10+ */ 
    background: -ms-linear-gradient(top, #eeeeee 0%,#b4b4b4 100%); /* IE10+ */ 
    background: linear-gradient(to bottom, #eeeeee 0%,#b4b4b4 100%); /* W3C */ 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#b4b4b4',GradientType=0); /* IE6-9 */ 
    border: solid #676767 2px; 
    border-radius: 3px; 
    color: #111; 
    font-family: Trebuchet, Arial, Helvetica, Sans-serif; 
    font-size: 12pt; 
    font-weight: normal; 
    height: 18pt; 
    line-height: 18pt; 
    text-align:center; 
} 
相關問題