我想在输入右侧放置一个图标,使其像组合一样。我必须使用位置相对因为它必须是完整的代码。我将编写一个jquery插件并在任何地方使用它。
这是我的代码。 Firefox和Chrome正确显示它,但IE-9有问题。如果我做了图标的margintop -15px它有点底部,如果我这样做-16px它会进入输入的顶部。
你可以在http://mrp.brove.net/explorer_relative.php
看到它我该如何解决这个问题?
<!DOCTYPE HTL>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body>
<div style="width:50%; position:relative; top:0; left:0; height:0; background-color:#ccc;">
<input class="rounded" type="text" style="width:100%;">
<img src="images/combo_sec.png" style="position:relative; z-index:2; float:right; margin-top:-16px; padding-right:5px;" />
</div>
</body>
</html>
答案 0 :(得分:2)
为什么不使用top:-value;
我认为这对你有用
如果你想使用margin-top
,只能将它用于ie9
margin-top/*\**/:-16px\9;
和你给的其他浏览器一样。
可能会帮助你。