assume have simple structure this:
<div class="a"> <div class="b"></div> </div>
i want give both #a
, #b
fixed width , height , center #b
in #a
:
#a { width: 199px, height: 199px; position: relative; } #b { width: 100px; height: 100px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto }
the trick here cannot centered because difference 99px , cannot divided evenly, there single-pixel shift somewhere. problem screen shows me 1 thing, javascript reports another. if read offsetleft
of #b
, see 50px, when measure on screenshot, it's 49px. (offsettop
seems ok, although in real app seem one-pixel error it).
here's jsfiddle.
this happens firefox 47.0.
Comments
Post a Comment