css:即改变按钮的文本值和背景
我在列表中有一个提交按钮:
<ul>
<li><input type="submit" value="Pls don't shift" /></li>
</ul>
- li 和输入有不同的背景,并且这些应该是可定位的。
- 输入应具有动态宽度(取决于值)。
- 输入的值应该几乎位于输入的底部。
这些事情减少了解决问题的机会。
问题正是:IE8和IE9移动了值的文本,IE8也移动了背景。
我试图解决这个问题并制作了这个 css(这只是一个“debug-css”):
li {
display: block;
width: auto;
border: 1px solid red;
padding: 0;
margin: 0;
float: left;
overflow: hidden;
}
input,
input:active:hover {
display: block;
background: url(tools-48x48.png) no-repeat center center;
width: auto;
height: 60px;
border: 1px solid transparent;
outline: none;
color: #fff;
text-align: center;
position: relative;
overflow: visble;
padding: 0 10px;
margin: 2px;
}
input:active:hover {
border: 1px solid red;
}
最有趣的是:现在如果我单击按钮的文本值,那么它会产生相同的错误转变,但是如果我单击其他位置(在按钮上,但不在文本值上),然后它就可以工作了。
这就是我想写在这里的时刻。 如何禁用提交按钮:IE 中的活动状态?
谢谢你!
I've got a submit button in a list:
<ul>
<li><input type="submit" value="Pls don't shift" /></li>
</ul>
- The li and the input have different backgrounds, and these should be positionable.
- The input should have dynamic width (depending on the value).
- The input's value should be almost at the input's bottom.
These things reduce the number of opportunities to solve the problem.
And the problem exactly is: IE8 and IE9 shift the text of value, and IE8 shifts the background too.
I've tried to solve it and made this css (this is only a 'debug-css'):
li {
display: block;
width: auto;
border: 1px solid red;
padding: 0;
margin: 0;
float: left;
overflow: hidden;
}
input,
input:active:hover {
display: block;
background: url(tools-48x48.png) no-repeat center center;
width: auto;
height: 60px;
border: 1px solid transparent;
outline: none;
color: #fff;
text-align: center;
position: relative;
overflow: visble;
padding: 0 10px;
margin: 2px;
}
input:active:hover {
border: 1px solid red;
}
And the most interesting thing is: Now if I click on the button's text value, then it makes the same bad shift, but if I click eslewhere (on the button, but not on the text value) then it works.
That was the point when I've minded to write here.
How to disable submit buttons :active state in IE?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经在 IE9 中对此进行了测试,当我删除几种“未”使用的样式时,输入文本在您单击它时不会发生变化。
删除样式:
并添加样式
请参阅我的小提琴以获取更多详细信息: http://jsfiddle.net/f67Vw/4 /
另一个不错的选择似乎是将其替换为精心设计的
a
元素。HTML
CSS
再次参见我的 Fiddle 了解更多详细信息: http://jsfiddle.net/f67Vw/4/
I have tested this in IE9 and when I remove several styles that "aren't" used the input text doesn't shift when you click on it.
removed styles:
and added the styles
See my Fiddle for more details here: http://jsfiddle.net/f67Vw/4/
A good other option seems to be to replace it with a carefully styled
a
element.HTML
CSS
Again see my Fiddle for more details here: http://jsfiddle.net/f67Vw/4/