css height 80% not working -



css height 80% not working -

i want create table take 80% of screen, right size of content in table.

#ecom-mainarea .center { margin-left: 10%; position: relative; width: 80%; height: 80%; /* when 500px works fine, % doesn't work */ border: 1px solid; border-bottom-color: teal; border-top-color: gray; border-left-color: gray; border-right-color: teal; background-color: white; voice-family: "\"}\""; voice-family: inherit; vertical-align: text-top; }

you need create sure htmland body elements have 100% height. need stretch top bottom. if not html , body element high table.

here have working sample:

<!doctype html> <html> <head> <title>table height</title> <style> html, body { padding: 0; margin: 0; height: 100%; } </style> </head> <body> <table style="background: cyan; height: 80%;"> <tr> <td> table has 80% of height of body </td> </tr> </table> </body> </html>

css

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -