So I have looked through a billion forums and threads but still cannot get the solution I'm looking for!
I have some text and buttons I would like to be both horizontally and vertically centered in a div using Bootstrap 3.
I have some code that looks like this:
<div class="Home" id="Home">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4 col-xs-12">
<p class="home">TEXT TO BE VERTICALLY CENTERED</p>
</div>
<div class="col-md-4">
</div>
</div>
</div>
(Please don't lecture me on using offsets. I know I should use them, I just am using those 3 divs for testing purposes haha)
Now I have used such CSS like:
.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one :-) */
display: flex;
align-items: center;
}
.text-vcenter {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.vcenter {
display: inline-block;
vertical-align: middle;
float: none;
}
Yet to no avail. My text (And buttons) just stay horizontally centered on the top of the page. I know this is probably an easy fix but it has literally been killing me for weeks now! I really am using this as last resort. I have even studied on how other sites vertically align items but nothing has worked.
And please keep in mind that it needs to maintain its responsiveness. I don't want fixed solutions.
I read somewhere that a JS solution might be the trick? I am really up for anything now at this point.
EDIT
How do I vertically center text with CSS?
does not solve my problem...
Only works for a single line of text though, because we set the line's > height to the same height as the containing box element.