仅在Internet Explorer中存在文本重叠问题
Text overlapping issue only in Internet Explorer
我有一个带有文本输入的搜索框,按钮输入与搜索框内的按钮并排。在InternetExplorer上,当我们键入一个长字符串时,文本会与按钮重叠。这与firefox和chrome等其他浏览器完美配合,不会出现文本重叠。
HTML代码:
<td style="width: 44%" align="right">
<div class="searchBox_div">
<input type="text" id="search" name="search" style="background-color: white; -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-left-colors: none; -moz-border-bottom-colors: none; border-color: black -moz-use-text-color black black; border-image: none; padding: 2px 15px 0 0; border-width: 1px;">
<input type="button" id="overlay_search" title="Perform Search" style="-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; padding: 5px 6px; border-width: 0px 0px 0px 0px;">
</div>
</td>
CSS:
.searchBox_div {
display: inline-block;
verticle-align: middle;
background: #FFF url(/themes/default/images/glyphicons-halflings-black.png) no-repeat 5px 6px;
position: relative;
}
.searchBox_div: before {
content: "";
display: block;
position: absolute;
background: url(/themes/default/images/glyphicons-halflings-black.png) no-repeat center center;
width: 24px;
left: 4px;
top: 50 % ;
margin-top: -12px;
z - index: 1;
overflow: hidden;
}
.searchBox {
height: 30px;
width: 400px;
padding-left: 30px;
font-size: 20px;
}
.searchBox_div::-ms-clear {
width: 0;
height: 0;
display: none;
}
#overlay_search {
position: absolute;
background: url(/themes/default/images/glyphicons-halflings-black.png) no-repeat center center;
width: 24px;
height: 24px;
right: -4px;
top: 50 % ;
background-position: -48px 5px;
margin - top: -11px;
z - index: 1;
display: inline-block;
overflow: hidden;
}
#overlay_cancel {
background-image: url("/themes/default/images/glyphicons-halflings-black.png");
background-position: -313px 5px;
background-repeat: no-repeat;
display: inline-block;
height: 24px;
line-height: 14px;
margin-top: 0;
vertical-align: text-top;
padding: 2px 25px 0 0;
width: 14px;
}
一旦我在stackoverflow上得到足够的分数,我就会发布截图。我正在从Dojo Javascript中尝试类似的东西,它对我有部分作用。但看起来并不像我想要的那么好。
if(dojo.isIE){
on(dom.byId("search"), "focus", function () {
style.set("search", "backgroundColor", "rgb(253,216,87)");
style.set("searchBox_div", "border-width", "1px");
style.set("searchBox_div", "backgroundColor", "rgb(253,216,87)");
style.set("searchBox_div", "background-position-x", "15px");
});
}
请帮助我在internet explorer中修复此问题。
如果你只在IE上有问题,你可以只针对不同版本的IE来设置CSS,我在不同的IE版本上也有这个问题,下面的解决方案帮了我很多忙,仍然对我有帮助:
检查浏览器兼容性:http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
例如,告诉我你在哪个版本的IE中有问题:你可以这样做来创建一个css文件,并在css 中进行编写
[if IE]
<link rel="stylesheet" type="text/css" href="your_css_that_will_affect_only_ie.css" />
[endif]
或者你可以做一些类似的事情
[if IE]
.searchBox_div {
display: inline-block; // u change anything here
verticle-align: middle;// u change anything here
background: #FFF url(/themes/default/images/glyphicons-halflings-black.png) no-repeat 5px 6px;// u change anything here
position: relative;// u change anything here
}
[endif]
我看不出资源管理器与您的代码有任何区别。我能给你这个级别的什么建议
#overlay_search{
right: -22px; // take it out completely from input field
}
如果这对截图没有帮助的话,现在看起来怎么样,以及你想要的样子。我会按照你的意愿来修复。
我通过从stratch添加CSS和HTML并删除绝对定位和其他不必要的CSS来解决这个问题。
<div>
<input type="text" class="tftextinput" name="search" id="search" size="21" style="border:gray solid;border-width: 1px 0px 1px 1px;"/>
<input type="submit" value="" id="overlay_search" class="tfbutton" style="border: 1px gray solid;height:22px;border-width: 1px 1px 1px 0px;"/>
</div>
.tftextinput{
margin: 0;
padding: 5px 15px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
width: 94px;
height:10px;
border:none;
}
.tfbutton {
margin: 0px;
height:20px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
background: url(/themes/default/images/glyphicons-halflings-black.png) #ffffff no-repeat center center;
background-position: -47px 3px;
border:none;
width:20px;
}
相关文章:
- 如何使用jquery在填充自动完成的值后使文本框只读
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 用程序搜索JQuery数据表中的文本
- jQuery匹配JSON对象的部分文本
- onkeyup无法动态创建多个文本区域
- 如何在下面的ES6循环中获得前面的文本
- HighCharts长标题文本在某些元素上重叠
- createjs动态文本重叠
- 如何使用setInterval和fillStyle修复文本重叠
- Svg文本元素被另一个Svg元素重叠
- jQuery/Javascript检查文本重叠
- MVC5 - 检查用于搜索日期字段的 2 个日期(文本框)之间的重叠
- 为什么图像和文本在我的对话框中重叠
- 仅在Internet Explorer中存在文本重叠问题
- Pixi.js中的文本出现重叠
- 具有重叠文本范围的解决方案
- 在javascript中创建重叠的文本跨度
- 如何使跨度重叠文本在td
- 如何避免文本重叠在html5画布