dimanche 26 juin 2016

Div always centered - even when scrolling page left and right

I have a simple HTML page with CSS code. I hope you will get the point. <div style="width: 1050px; top: 0; left: 50%; margin-left: -525px; position: fixed; z-index: 10;"> This is working OK. </div> <div style="white-space: nowrap; margin-left: auto; margin-right: auto; margin-top: 150px; overflow: visible;"> Here is text which is so long that a horizontal scrollbar will be needed for the browser window. </div> <div style="clear: both; position: relative; overflow: hidden; width: 1050px; margin-left: auto; margin-right: auto;"> <div style="position: relative; clear: both;"> <div style="clear: both; width: auto; margin-left: 30px; margin-right: 30px;"> This is not working OK. This div should always, even after scrolling the page left and right, be centered (horizontally, not vertically) and on the bottom of the page - not on the bottom of the screen. </div> </div> </div> So, how could I fix the code? It would be great to get some help. For me, this is an urgent issue. Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire