Jump to content

use only % to position buttons and tables?


smartalarm

Recommended Posts

Hi

 

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

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...