Jump to content
Sign in to follow this  

use only % to position buttons and tables?

Recommended Posts



I try to make a new webinterface for my alarm system in html5 and would like to create buttons nicely spread over the height and width of the webpage.


Any resolution on PC or Tablet, Smartphone should always give more or less the same results. Thats why I can not use px but need % right?


Is that possible? I struggled to do that in html5 and hope to find some example or help over here.


In html 3 it was no problem but now when I try to use html 5 it seems to have changed a lot.



In attachment an example of the old page in html 3.


Thanks for any advise and help,


Wim ( Thailand )




example webpage 27-10-2013.pdf

Share this post

Link to post
Share on other sites

The width is simple, just use width:100%; on each div you want to be as wide as the window. If you want some margin on the sides with the div centered you just set the width to be 90% (for example) and then add margin: 0 auto; for centering the divs. (Be aware that you can't float the elements if you want to center with margin.)


You should be able to do the same thing with the height if you set both the body and the html to height:100% and then set the inner divs heights so that the total height is 100%.Beware that the height of the divs can become very tight on smaller screens.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...