How do I get rid of an element's offset using CSS?

后端 未结 13 1290
春和景丽
春和景丽 2020-12-04 08:43

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

\"W

13条回答
  •  鱼传尺愫
    2020-12-04 09:20

    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
    before it or any other element, it would change the offset. For example, you could set it to 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?

提交回复
热议问题