2016-09-18 202 views
0

無法將按鈕的圖像更改爲箭頭,嘗試了多件事但未完成工作。更改按鈕的背景圖像

button .arrow{ 
 
     background-image: url("http://alexoliveira.me/Hawaii/images/chevron-left.png"); 
 
     background-repeat: no-repeat; 
 
     background-position: 50% 50%; 
 
     /* put the height and width of your image here */ 
 
     height: 50px; 
 
     width: 200px; 
 
     border: none; 
 
    } 
 
    
 
    .arrows { 
 
     width: 100%; 
 
     height: 100%; 
 
     display: flex; 
 
     align-items: center; 
 
     justify-content: space-between; 
 
     position:absolute; 
 
    
 
    }
<div class="arrows"> 
 
     \t \t <button onClick="carousel(-1)" class="arrow" style="width:20px;height:40px;"></button> 
 
     \t \t <button onClick="carousel(1)" src="http://alexoliveira.me/Hawaii/images/chevron-right.png" class="arrow" style="width:20px;height:40px;"></button> 
 
     \t </div>

回答

1

只需更新你的CSS來button.arrow(刪除空格)。你必須調整你的樣式表然後

+0

background:url(http://alexoliveira.me/Hawaii/images/chevron-left.png)不重複50%50%透明;也許? :-) –

+0

與我使用它的圖像並不相當鍛鍊 – Tahtoh

+0

是的,你必須選擇一個適合你的寬度和高度的按鈕 –