html - Height percentage not working in CSS -


i trying use height property using percentages, doesn't work. want use percentage looks fine in resolution.

<div id="bloque_1" style="height: 80%;background: red">    </div> 

how can make work?

when using % width, or height, 1st question should ask 80% of what? need apply height parent element, assuming element of yours inside body tag, need use in css

html, body {    height: 100%; } 

so div element 80% of 100%

demo

side note: when dealing absolute positioned elements, may come across scenario div won't exceed current viewport height, in case need have min-height


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -