[web] how to center div?
you have to set the margin like this:
<div style="width:[width here]; margin: 0 auto;></div>
you can change the 0 to whatever you want. (Not really HTML but CSS is your friend [smile])
<div style="width:[width here]; margin: 0 auto;></div>
you can change the 0 to whatever you want. (Not really HTML but CSS is your friend [smile])
Quote:Original post by capn_midnightWhat browser are you using? When I do that in FireFox the div stays left-aligned and the text inside is centered.<div align="center">blah</div>
Quote:Original post by DigiDudeQuote:Original post by capn_midnightWhat browser are you using? When I do that in FireFox the div stays left-aligned and the text inside is centered.<div align="center">blah</div>
That's what it *should* do. The margin: auto is the correct way to do it, but IIRC Internet Explorer doen't like it (no surprise here...)
well after further use, the div now seems to be aligning itself to the left. using capn_midnights example. any more help?
edit: yeah, it behaves like DigiDude said. i'll try your example digidude.
edit: yeah, it behaves like DigiDude said. i'll try your example digidude.
Many "Lounge Lizards" don't know there are other forums on GameDev, including the Web Development Forum [wink]. And yes, <div align="center">blah</div> it is.
Quote:Original post by Rob Loach
And yes, <div align="center">blah</div> it is.
No no, that centers the content of the div.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement