I have a problem about div height with out no any content inside the div.need to automatically adjust browser height. Need to know about view port height and width
Asked
Active
Viewed 116 times
1 Answers
0
If you use
html, body {
margin: 0;
padding: 0;
height: 100%;
}
your website will fit the viewport. A div inside would then need
div {
height: 100%;
}
as well to fill the viewport.
html, body, div {
height: 100%;
margin: 0;
padding: 0;
}
html {
background: #00ff00;
}
body {
background: rgba(255,0,0,.5);
}
div {
background: rgba(0,0,255,.3);
}
<html><body><div>This is inside the div. HTML has green background, body is red and the div is blue, since they overlay each other the resulting background should be greyish.</div></body></html>

Paul
- 8,974
- 3
- 28
- 48