I've got a positioning problem with some elements, upon inspecting it IE8 Developer tools it shows me this:
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?
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
display: none; 'Unlike the visibility property, which leaves an element in normal document flow,display: none removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code. This is because it is, indeed, removed from the document flow.
Definition and Usage The outline-offset property adds space between the outline and the edge or border of an element. The space between an element and its outline is transparent.
jQuery . offset() will get the current coordinates of the first element, or set the coordinates of every element, in the set of matched elements, relative to the document.
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:
#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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With