更改按钮的背景图像

时间:2016-09-18 21:07:00

标签: html css html5 image css3

无法将按钮的图像更改为箭头,尝试了多项但却无法正常工作。

    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">
      		<button onClick="carousel(-1)"  class="arrow" style="width:20px;height:40px;"></button>
      		<button onClick="carousel(1)" src="http://alexoliveira.me/Hawaii/images/chevron-right.png" class="arrow" style="width:20px;height:40px;"></button>
      	</div>

1 个答案:

答案 0 :(得分:1)

只需将你的css更新为button.arrow(删除空格)。你必须调整你的样式表