提交按钮上的图像

时间:2016-02-07 18:57:56

标签: html css

我一直在尝试更改输入提交按钮背景的图像,我遵循了许多教程,但没有一个帮助。该按钮仍然没有出现。这是代码片段。

 <input type="submit" name="submit" value="" alt="submit">

input[type="submit"] {
  background: url(../icons/submit_icon.png) no-repeat 0 0;
  display: block;
  height: 25px;
  text-indent: -9999px;
  width: 28px;
  border: 0;
}

1 个答案:

答案 0 :(得分:1)

我尝试了你的代码并且它有效,这里是小提琴: https://jsfiddle.net/268rLw9v/1/

我认为你的问题是因为图像(或输入)的大小,在我的例子中,我改变了输入的宽度和高度,因为我使用的图像更大。

width: 250px; height: 280px; // I used that because of the image size

确保您的图片尺寸合适。 您还可以尝试使用这些css属性来查看会发生什么:

background-size: cover;
background-position: center;
相关问题