Reputation: 1913
Good afternoon!
I have to stretch each section of the landing page to a full-page size. Is it possible in my case using CSS rules only?
The section looks like this:
The css rule for this section:
element.style {
width: 100%;
height: 100%;
z-index: 2;
position: absolute;
left: 0;
top: 0;
}
Upvotes: 1
Views: 58
Reputation: 36742
You can use 100vh
which will set the height to the height of the viewport.
/* for demo only ... */
body {
margin: 0;
}
div:nth-child(1) {
background: red;
}
div:nth-child(2) {
background: green;
}
div:nth-child(3) {
background: blue;
}
/* Important bit... */
div {
height: 100vh;
}
<div></div>
<div></div>
<div></div>
Upvotes: 1
Reputation: 115
Since its positioned absolute, you can use the following css to make it 100%.
element.style {
z-index: 2;
position: absolute;
top: 0;
right: 0;
bottom:0;
left:0;
}
See this Fiddle: https://jsfiddle.net/v6Lkkq4n/
Upvotes: 0