Reputation: 1121
Ok really simple question, I want to make a section 100% height of the viewport, I understand that the parent element needs to have a defined height but it still doesn't work for me. Help me understand if I'm overlooking something!
html {
height: 100%;
}
body {
margin: 0px;
padding: 0px;
}
section {
width: 100%;
height: 100%;
background:red;
}
Upvotes: 0
Views: 139
Reputation: 311
You have to set the height 100% at the BODY and the HTML.
body, html {
height: 100%;
}
Upvotes: 1
Reputation: 4046
Use This Css DEMO HERE
html, body {
margin: 0px;
padding: 0px;
height:100%;
}
section {
width: 100%;
height: 100%;
background:red;
}
Upvotes: 0