I've got a positioning problem with some elements, upon inspecting it IE8 Developer tools it shows me this:

我有一些元素的定位问题,在检查IE8开发工具时它向我展示了:

Now I'm pretty sure my problem is that 12 offset, but how do I remove it? I can't find any mention of a CSS offset property. Do we need an Offset in addition to margin?

现在我很确定我的问题是12个偏移量,但是我怎么去掉它呢?我找不到任何CSS偏移属性的提及。除了保证金,我们还需要加减吗?

Here is the code thats producing this:

下面是产生这个的代码:

 <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>

The element with the offset is inputBox

带有偏移量的元素是inputBox

12 个解决方案

#1


41

That offset is basically the x,y position that the browser has calculated for the element based on it's position css attribute. So if you put a <br> before it or any other element, it would change the offset. For example, you could set it to 0 by:

这个偏移量基本上是浏览器根据位置css属性计算的元素的x,y位置。如果你把
放在它或任何其他元素之前,它会改变偏移量。例如,你可以将它设置为0 by:

#inputBox{position:absolute;top:0px;left:0px;}

or

#inputBox{position:relative;top:-12px;left:-2px;}

Therefore, whatever positioning issue you have, is not necessarily an issue with offset, though you could always fix it by playing with the top,left,right and bottom attributes.

因此,无论您有什么定位问题,都不一定是偏移问题,尽管您可以通过使用顶部、左侧、右侧和底部属性来修复它。

Is your problem browser incompatibility?

你的浏览器不兼容吗?

更多相关文章

  1. KeyPress或KeyDown事件没有得到html元素的buind
  2. htmlhref属性最大支持多少个字符???(高分)
  3. 行内元素与块级元素
  4. 固定定位,父元素具有转换
  5. HTML语言中img标签的alt属性和title属性的作用与区别
  6. 在c#中获取html元素的实际边距
  7. html中插入activex控件之后 需要在 网页中实现控件的属性及方法,
  8. 两个堆叠的元素与他们旁边的元素成比例增长
  9. html css伪元素标签(二)灵活

随机推荐

  1. 在Python中,如何在使用WPF的程序中自动控
  2. CentOS下实现Flask + Virtualenv + uWSGI
  3. PySide-QtWebKit: CSS font-family没有效
  4. python学习笔记10(函数一): 函数使用、调用
  5. python爬取csdn的博客内容
  6. 利用python Pandas进行数据预处理
  7. python 带正则的search 模块
  8. Python基础1--数据类型
  9. 第四章 Python 对象
  10. python调用shell命令之三慷慨法