【发布时间】:2011-06-16 14:35:07
【问题描述】:
我遇到了一些元素的定位问题,在检查它时 IE8 开发人员工具显示如下:
现在我很确定我的问题是 12 偏移量,但是我该如何删除它?我找不到任何提及 CSS 偏移属性的内容。除了边距,我们还需要偏移量吗?
这是产生这个的代码:
<div id="wahoo" style="border: solid 1px black; height:100px;">
<asp:TextBox ID="inputBox" runat="server" />
<input id="btnDropDown" type="button" style="width:26px; height:26px; background-position: center center; border-left-color: buttonface; background-image: url(Images/WebResource.gif); border-bottom-color: buttonface; border-top-color: buttonface; background-repeat: no-repeat; border-right-color: buttonface;" tabindex="99" />
<div id="ListboxWrapper" style="display:none; position:absolute; onfocusout="this.style.display = 'none'"">
<asp:ListBox ID="lstBoxCompany" runat="server" AutoPostBack="True" OnSelectedIndexChanged="lstBoxCompany_SelectedIndexChanged" style="z-index: 100;" Width="300px" />
</div>
</div>
偏移量为inputBox的元素
【问题讨论】:
-
你的元素定位了吗?检查
left和top属性。 -
一点代码在这里会非常有用。 CSS 中没有“偏移”规则,但 IE 确实倾向于在随机位置添加随机像素。它通常与浮动和定位有关
-
我会假设“偏移”是“与其他元素相关的像素” - 例如前一个元素的边距将这个元素向下推。我现在没有时间尝试 IE 开发工具来找出答案。
-
我已经添加了完整的内联 CSS 代码,所以我们可以看到发生了什么
-
是否有我们可以查看的网页示例 - 例如,我们可以将 firebug 指向它并了解更广泛的页面。例如。您的输入控件是否继承了另一个 CSS 定义的边距或填充?
标签: html css internet-explorer user-interface