Typically, we want to center an element and do this:
#element {margin:0 Auto;}
Suppose you want to keep this element position fixed? In general we will join Position:fixed, for example the following:
#element {position:fixed;margin:0 Auto;}
But the result of this is. The element is not centered. This indicates that the fixedthe object is out of normal document flow.
How to resolve:
#element {position:fixed;margin:0 auto;left:0;right:0;}
However, you will not be able to work in the IE7 version number below to change it to:
#element {position:fixed;margin:0 Auto;left:auto;right:auto;}
Finally we can do this:
if ($.browser.msie && parseint ($.browser.version) <= 7) { stralertwrapper.css ({position: ' fixed ', Bottom: ' 0 ', Height: ' Auto ', left: ' Auto ', right: ' Auto '}; }
Demo Sample code: http://jsfiddle.net/4Ly4B/33/
If you are helpful, welcome to add: QQ Group:124116463. Discuss the front-end technology together!
CSS3 Position Fixed centering problem