Can anyone lend a hand with vertically aligning text in a Bootstrap button?
When I use the align-middle
class, the text is aligned as desired. However, if I use the align-top
class, the text remains top-aligned no matter what I do. Any suggestions?
Here's a screenshot of the buttons:
https://i.sstatic.net/7RY9l.png
/* added by editor for demo purpose */
button {
min-height: 80vh;
}
<!-- Bootstrap-4 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Body -->
<div class="d-flex justify-content-between px-1 py-1 vh-100 align-middle">
<a href="#link" class="btn btn-outline-primary btn-lg w-50 align-middle" type="submit">
<h1>Header 1</h1>
<p>This is text.</p>
</a>
<button class="btn btn-outline-primary btn-lg w-50 align-middle" type="submit">
<h1>Header 2</h1>
<p>This is more text.</p>
</button>
</div>