[英]Not getting image over the submit button
I am trying to get an image over my button, but I am not getting it. 我试图通过按钮获取图像,但没有得到。 Here is what I have been doing.
这是我一直在做的。
<span id="schedule_button">
<input type="submit" value="submit"
style="background-image:url(scheduler_button.gif);
font-size:0px; width:270 px; height:66 px" />
</span>
Where am I going wrong ? 我要去哪里错了?
There are two problems: 有两个问题:
Update: As King King brings to notice in comments, it's only the second problem which causes your troubles. 更新:正如King King在评论中引起注意的那样,这只是引起您麻烦的第二个问题。
The input
element is by default inline, so when you set font-size to 0px, it takes only that much space as required to display the value, which is very little, input
元素默认为内联,因此,当您将font-size设置为0px时,它仅占用显示该值所需的空间,该空间很小,
Thus, it is necessary to set its display
to block
. 因此,有必要将其
display
设置为block
。
You might want to google "Inline vs Block elements." 您可能要谷歌“内联与块元素”。
You need to remove the space in width:270 px
and height:66 px
. 您需要删除
width:270 px
和height:66 px
。
input {
background:url('http://placehold.it/270x66');
font-size:0px;
width:270px;
height:66px
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.