【问题标题】:Removing displacement of button on IE when clicking单击时删除 IE 上按钮的位移
【发布时间】:2011-08-14 20:43:34
【问题描述】:
当你点击 IE 上的一个按钮时,文本会稍微向右下方移动,以产生被按下的效果。
但是,如果您自定义按钮并在其上添加例如背景图像(如“提交 ->”中的箭头),则此效果看起来不太好。有没有办法删除它?我尝试在元素为 :active 时添加填充,但它仍然不会覆盖效果(我认为 button:active 在 IE7 上不起作用)。
有人可以帮我解决这个问题吗?
提前致谢!
【问题讨论】:
标签:
internet-explorer
button
click
【解决方案1】:
我的表单按钮在 IE 中“跳跃”或移动位置时遇到问题,我找到的解决方案是:
1.) 为表单按钮提供相等的边距
2.) 在您的按钮周围放置一个包装器分区并根据您的喜好放置分区
#myButton {
border: 1px solid #f7f6f4;
font-family: Times New Roman;
font-size: 16pt;
padding:15px;
margin:10px;
}
<div style="float:right;margin-right:75px;">
<input type="submit" name="myButton" id="myButton" value="Don't Move!" />
</div>
让我知道这是否适合您的情况..
【解决方案2】:
只需将按钮放在 div 标签内即可。
<div><input type="submit" name="myButton" id="myButton" value="Don't Move!" /></div>
这对我有用。