I have the following code snippet:
#content{
text-align: center;
vertical-align: middle;
}
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div id="content">
<h1>Sample Text</h1>
<h3>Subtext to the intro to the site</h3>
<hr>
<button class="btn btn-default btn-lg">Get Started!</button>
</div>
</div>
</div>
</div>
</body>
I'm using Bootstrap's grid system. I want to be able to vertically center the contents of the div with id="content"
(basically I want the whole content to be horizontally and vertically centered even as the page is resized). This is meant to be a splash page with an image as the background. How can I do that using CSS? vertical-align: middle
does not work.
And just for my learning, does text-align: center
basically center any element even though the name seems to indicate it is for text?