Advertisement Jump to content
Sign in to follow this  

[web] How to centre html objects in middle of the page?

This topic is 4887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I want to centre a div tag coloured box with text into the middle of the screen, horizontally and vertically. I thought the easiest way to do this is just use a table with one cell. So Im trying to make the table's height 100%, but it won't even budge. 100% width works fine, and on the table im using absolute positioning, any idea why this won't work? Thanks

Share this post

Link to post
Share on other sites
Maybe your code isn't correct, but here's something that I used recently and it worked fine:

<table width="100%" height="100%" align="center" valign="middle">
<td>Text that's centered</td>

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!