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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -