Reputation: 371
I have been trying to figure out a solution for this and have been searching forums but thy only talk about percentages.
I have a div that contains text only. I need it to have a max-width of 700px, be positioned fixed and be centered horizontally on the screen.
In a perfect world, this is what I want to work but of course it won't:
<div style="max-width: 700px; text-align: center; position: fixed; bottom: 40px; margin: auto;">sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text</div>
Does anyone have a solution?
Upvotes: 1
Views: 64
Reputation: 115202
set left:0;right:0;
<div style="max-width: 700px; text-align: center; position: fixed; bottom: 40px; margin: auto;left:0;right:0;">sample text</div>
Upvotes: 5