2017-04-05 57 views

回答

0

使用 background: url(yourimage.png) center center no-repeat transparent; 在按鈕上用CSS設置背景圖片。

現在已經有回答問題#2:

<input type="button">背景:How to add background image for input type="button"? <button>背景:<button> background image

.button{ 
 
     background: url(http://www.essenzialmenta.it/wp-content/uploads/2014/03/ytbtn-1.png) center center no-repeat transparent; 
 
     cursor:pointer; 
 
     border: none; 
 
     padding: 100px; 
 
     }
 <input type="button" name="button" value="Button" class="button"/>   
 

+0

嗨,感謝您的回覆,但它似乎有點奇怪的懸停效果和按鈕的大小,雖然http://www.essenzialmenta.it/test-btn/ – mario

+0

編輯:減少填充,但仍懸停問題 非常感謝你! – mario

+0

只使用'背景顏色:#ddd' https://jsfiddle.net/w08ps6r6/ – Syno

0

ü可以嘗試,

CSS

.button-image{ 
    height: 50px; 
    width: 75px; 
    background: url(your-image.jpg) center center no-repeat transparent; 
    border: none; 
    display: block; 
} 

HTML

<button class="button-image">Button Text</button> 

你可以改變高度和寬度按您的要求。