[英]Overlap fontawesome icon to input IE
I want to make a Font Awesome icon overlap to an input. 我想使“真棒字体”图标与输入重叠。 This because i want the button to be the icon itself. 这是因为我希望按钮成为图标本身。
My solution works well in Firefox and Chrome, but it does not work in IE . 我的解决方案在Firefox和Chrome中运行良好, 但在IE中却无法正常工作 。 This means that in IE the button is not clickable because it happens that the icon goes OVER the button. 这意味着在IE中该按钮不可单击,因为碰巧该图标移到该按钮上。
This is the HTML: 这是HTML:
<span>
<input type="button"/>
<i class="fa fa-camera-retro"></i>
</span>
CSS: CSS:
span {
position: relative;
}
input {
position: relative;
background: none;
border: none;
z-index: 2;
cursor: pointer;
}
i {
position: absolute;
left: 0;
}
The strange thing is that this code works well in JSFiddle. 奇怪的是,此代码在JSFiddle中运行良好。
UPDATE : I must use the input. 更新 :我必须使用输入。
If you need a button (such as for a form), you can use: 如果需要按钮(例如用于表单),则可以使用:
<button><i class="fa fa-camera-retro"></i></button>
Alternatively, try using a label pointing to the input if you absolutely must have the input element button: 或者,如果绝对必须具有输入元素按钮,请尝试使用指向输入的标签:
<span>
<input id="myButton" type="button"/>
<label for="myButton" class="fa fa-camera-retro"></label>
</span>
Try this: <a href = "#"><i class="fa fa-camera-retro"></i></a>
尝试以下操作: <a href = "#"><i class="fa fa-camera-retro"></i></a>
Using a link instead of a button might solve your problem. 使用链接而不是按钮可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.