I understand that in order for an element to be height 100% of the viewport the parent has to have a fixed height or for html and body to be height 100%.
My problem is I have an introduction title which I want in the middle of the screen, easy I thought, I will make a div 100% width and height then the user scrolls down to reach the rest of the content... Not so easy. For the div to be 100% height I need to make html height 100% but when I do that the gradient background repeats itself as it reads the height of the viewport (html 100%) and not the content.
The site is here.
Code:
<div class="intro">
<div class="intro_text">
<h2><?php the_title(); ?></h2>
<h3><?php the_date('Y'); ?></h3>
</div>
</div>
<div id="content">
<!--The user scrolls down to see this-->
</div>
html {
width: 100%;
height: 100%;
}
body {
width: 100%;
height: 100%;
background-color: #004000;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ec448c), to(#5a94bc));
background: -webkit-linear-gradient(top, #ec448c, #5a94bc);
background: -moz-linear-gradient(top, #ec448c, #5a94bc);
background: -ms-linear-gradient(top, #ec448c, #5a94bc);
background: -o-linear-gradient(top, #ec448c, #5a94bc);
}
.intro {
width: 100%;
height: 100%;
}