css - 空白被添加到 IE9 中的叠加层中,但 Fx5 中没有

标签 css html overlay internet-explorer-9

我正在尝试在 Google Maps API V3 上覆盖一个“搜索框”。覆盖在 Fx5 中工作正常,但在 IE9 中它不能正常工作。 IE9 在 map 和灰色 div 之间添加了一些空白。要查看差异,请转到:

http://www.trailheadfinder.com/trail_search/trail_map

“搜索框”应该与 Map/Sattelite/MyTopo 按钮对齐。

HTML

<div id="maplayers">
 Select information to be shown:
 Trails: <input type="checkbox" id="trailsbox" onclick="boxclick(this,'trails')" />
 Campgrounds: <input type="checkbox" id="campgroundsbox" onclick="boxclick(this,'campgrounds')" />
 Panoramio: <input type="checkbox" id="panoramiobox" />
</div>
<div>
 <div id="mapsearchbar">
  <input id="searchTextField" type="text" size="50">
 </div>
 <div id="map" style="width: 100%; height: 500px"></div>
</div>

CSS

<style type="text/css">
#mapsearchbar {
 float: right;
 position: relative;
 right: 200px;
 top: 5px;
 z-index: 999;
}
#maplayers {
 padding-top: 10px;
 padding-bottom: 10px;
 padding-left: 10px;
 margin-top: 20px;
 background-color: #C4C4C4;
}
</style>

最佳答案

之所以存在差距,是因为你给它一个相对位置,然后使用 top: 5px 进行偏移;右:200px。这导致它移动但在其原始位置留下间隙。按如下操作。

div
{
position: relative;
}

div#mapserachbar
{
position: absolute;
top: 5px;
right: 170px;
}

并从中删除 float:right。

关于css - 空白被添加到 IE9 中的叠加层中,但 Fx5 中没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6538968/

相关文章:

css - overflow-x 滚动不工作 css

Android ImageView 覆盖 Opengl ES 意外行为

javascript - OpenLayers3 : more than one overlay at a time?

jquery - 使div在叠加层后面不可选择

html - Bootstrap 汉堡菜单图标栏不会改变颜色

html - 图像缩放/放大缩略图

css - TailwindCSS : is it possible to remove a box-shadow on print?

html - 我的 CSS 滚动捕捉点有问题

javascript - 视觉变形| SVG、Canvas 与其他

java - 当与 <pre> 标签一起使用时,使用 HTMLEditorkit 设置的 JTextPane 不遵循文本对齐样式