Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean to give a div a style='height:100%'?

Tags:

html

css

There's lots of questions on SO related to this, but the ones I scanned are all for detailed specific situations. What I want to know is, at a conceptual level, what does it mean to say:

<div style='height:100%'>

How high is 100%? 100% of what?

[EDIT]

Followup question: If 100% represents the height of the parent, but the parent is <body> and has no height other than the height of the div, then what does it mean? It seems recursively defined.

like image 955
Scott Stafford Avatar asked Jun 22 '12 15:06

Scott Stafford


People also ask

What does setting height 100% do CSS?

So, if your element is inside another element that has a height of 100px, and you set the child element's height to 100%. The child element will be 100px high. The height available to the child element is constrained by the height of the parent.

What does HTML height 100% mean?

For years, the answer was the following: html { height: 100%; } body { min-height: 100%; } This allows the HTML element to reference the parent viewport and have a height value equal to 100% of the viewport value.


1 Answers

The height:100% means : Make that div big as the parent!

like image 119
Ionel Lupu Avatar answered Oct 04 '22 04:10

Ionel Lupu