作为提交按钮(CSS)时悬停图像不显示

时间:2013-06-13 18:28:48

标签: html css

我已经创建了一个表单,通过电子邮件向我发送答案,一切都很好,直到我改为“提交”按钮。我有一个“提交”图像很好,但当我将鼠标悬停在它上面时,我的悬停图像不会出现。这是我的代码。我哪里错了?

/*buttons*/
.submitbut {
background: url("images/z_submit.jpg")  no-repeat; border: none;
display: block;
width: 62px;
height: 36px;

}
.submitbut:hover {
background: url("images/z_submit_roll.jpg")  no-repeat; border: none;
background-position: 0px -50px;
display: block;
width: 62px;
height: 36px;
}

我拥有的HTML代码是......

<input type="submit" class="submitbut" value="" />

1 个答案:

答案 0 :(得分:2)

首先,你可以摆脱几个声明:

.submitbut:hover {
    background: url("images/z_submit_roll.jpg")  no-repeat; border: none;
    background-position: 0px -50px;
}

其次,如果它不起作用,只有两件事可能是错的:

  1. images/z_submit_roll.jpg不存在,或者;
  2. 您已经错误地转移了background-position
相关问题