html - Fixed position & centering not in center -
i have been learning more css , js lately , made lame website :p. problem have got centering "commercial ip detected" box on last phase of js script. can guys take it, because kind of gave up... :d
what used center - inline:
style="top: 50%; left: 50%; display: block;"
the element position:fixed well
like to website: http://baciu.ro/test/mortalkombatx-theme/
link picture of problem: http://i60.tinypic.com/29eq71t.png
you should have on centering in css: complete guide chris coyier.
otherwise, favorite way kind of fixed element is
.element { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 200px; height: 200px; margin: auto; }
or if there no size defined:
.parent { position: relative; } .child { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }
good luck'
Comments
Post a Comment