Reputation: 7717
I need help with the CSS to have 5 rows stacked on top of each other, and each row is 100% height and 100% width of the browser.
Here's my HTML:
<div id="wrapper">
<div class="container-fluid">
<div class="row-fluid fullscreen"><a name="1"></a>
<h1>section 1</h1>
</div>
<div class="row-fluid fullscreen"><a name="2"></a>
<h1>section 2</h1>
</div>
<div class="row-fluid fullscreen"><a name="3"></a>
<h1>section 3</h1>
</div>
<div class="row-fluid fullscreen"><a name="4"></a>
<h1>section 4</h1>
</div>
<div class="row-fluid fullscreen"><a name="5"></a>
<h1>section 5</h1>
</div>
</div>
Here's my CSS:
html,body { margin:0; padding:0; }
.fullscreen { height:100%; width:100%; }
Thanks in advance!
Upvotes: 1
Views: 818
Reputation: 484
Instead of using 100% for your height, you could use 100vh. vh
is viewport height.
Your .fullscreen
css should now be:
.fullscreen {
height: 100vh;
width: 100%
}
Upvotes: 1
Reputation: 1323
try this may help you in your css
html, body
{
height: 100%;
}
body
{
min-height: 100%;
}
.fullscreen
{
height:100vh;
}
Upvotes: 1
Reputation: 597
CSS:
html,body {
height: 100%;
width: 100%;
margin:0;
padding:0;
position: relative;
}
#wrapper {
height: 100%;
width: 100%;
}
.container-fluid {
height: 100%;
width: 100%;
}
.fullscreen {
height: 100%;
width: 100%;
position: relative;
}
HTML:
<div id="wrapper">
<div class="container-fluid">
<div class="row-fluid fullscreen"><a name="1"></a>
<div class="span12"><h1>section 1</h1><span>
</div>
<div class="row-fluid fullscreen"><a name="2"></a>
<div class="span12"><h1>section 2</h1><span>
</div>
<div class="row-fluid fullscreen"><a name="3"></a>
<div class="span12"><h1>section 3</h1><span>
</div>
<div class="row-fluid fullscreen"><a name="4"></a>
<div class="span12"><h1>section 4</h1><span>
</div>
<div class="row-fluid fullscreen"><a name="5"></a>
<div class="span12"><h1>section 5</h1><span>
</div>
</div>
Upvotes: 0
Reputation: 798
just replace the height:100% by 100vh
.fullscreen { height:100vh; width:100%; }
Upvotes: 1
Reputation: 3254
You could use viewport height
property to set height of each div equals screen height like height: 100vh;
.fullscreen { width:100%; height: 100vh; }
You can read about it for example here or just google it.
But unfortunately it's not cross-browser method, so if you need full support you should use js or jQuery to set height of each div equals window height.
Read this Get the browser viewport dimensions with JavaScript
Upvotes: 1
Reputation: 599
See example maybe used for you: fiddle
CSS:
html,body {margin:0; padding:0; height:100%; width:100%;}
#wrapper, .container-fluid, .fullscreen { height:100%; width:100%; }
Upvotes: 0