I have two divs in my page and I would like both to have its width and height set to the width and height of the browser, so that I have to scroll down to see the second div.
How is this possible?
Eidt: I forgot to mention that I also want the content in these divs to be vertically centered.
What I did until now is taking this links first answer and put that code into another div, which takes 100% of the height.
Here is what I have at the moment:
HTML:
<body>
<div id="first"><div class="outer"><div class="middle"><div class="inner"><h1>Title 1</h1></div></div></div></div>
<div id="second"><div class="outer"><div class="middle"><div class="inner"><h1>DTitle 2</h1></div></div></div></div>
</body>
CSS:
.outer {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.middle {
display: table-cell;
vertical-align: middle;
}
.inner {
margin-left: auto;
margin-right: auto;
width: 100%;
}
#first, #second {
height: 100%;
}
h1 {
text-align: center;
}