html - 表单提交按钮移动切割图像

标签 html css

我有一个提交按钮并使用以下 css 对其进行样式设置:

.subm
{    
background-color:Transparent;
background-image:url(Images/Button_Send.png); 
background-repeat:no-repeat;
width:82px;
height:30px;
display:block;
border:none;
outline:none;
overflow:visible;}

   .subm:hover
{
    background-color:Transparent;
    background-image:url(Images/Button_Send_Over.png); 
    background-repeat:no-repeat;
    width:82px;
    height:30px;
    display:block;
  border:none;
    outline:none;
    overflow:visible;
}

这是 html:

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

没什么奇怪的。然而,令我恼火的是,当在 IE 中单击提交按钮时,它会将图像向上移动几个像素并切断它们,这使得它看起来,嗯,好词,'naff'。我该如何补偿或阻止这种情况?

我已经尝试扩展图像并在顶部留下几个空白像素,但它仍然做同样的事情!

谢谢 R。

最佳答案

当我在 IE 中点击它们时,我也遇到了按钮移动的问题。我找到的解决方案是:

1.) 给你的按钮一个相等的边距 2.) 将按钮放在您可以根据自己的喜好放置的包装部分

.subm {    
   background-color:Transparent;
   background-image:url(Images/Button_Send.png); 
   background-repeat:no-repeat;
   width:82px;
   height:30px;
   display:block;
   border:none;
   outline:none;
   overflow:visible;
   margin:10px; //maybe more maybe less
}

<div style="position:...;float:...;">
  <input type="submit" class="subm" name="myButton" id="myButton" />
</div>

虽然我必须提到,在我的特定情况下,我通过 ID 设置按钮的样式而不是应用类,因此您可能会遇到使用 .subm 类的多个按钮的问题。这在 IE 中对我有用。

关于html - 表单提交按钮移动切割图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1718462/

相关文章:

PHP HTML 表单保留输入的数据和 isset()

javascript - Instagram 上的图片已经停止传播

java - 简单的 JSP 页面未加载

css - div 元素在指定时不像 block 一样

Jquery 图像投票

html - 使用 Razor 的条件 HTML 属性

javascript - 即使启用了 JavaScript,也会显示 Noscript 标签的内容?

javascript - 使用 .show() 和 .hide() 具有两个不同的功能,而不会相互冲突

html - 页脚粘在底部,但在浏览器调整大小时,页脚被推到内容顶部

css - 有什么方法可以在开发人员工具中检查::first-line 和::first-letter 伪元素?