Nikita Ribakovs Nikita Ribakovs - 1 year ago 97
CSS Question

Vertical and horizontal alignment (Boostrap 4)

I'm trying to align text and button vertically as well as horizontally and cannot make it...
What I want ultimately is that alignment was responsive.
My code:

<div id="stage">
<div id="stage-caption">
<h1 class="display-3">Gallery Nellija</h1>
<p>Some description</p>
<a href="" class="btn btn-lg btn-success">Sign up now</a>


#stage {
background: url('img/stage.jpg') center center no-repeat;
background-size: cover;
color: white;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;

#stage-caption {
font-size: 1.4rem;
font-weight: 200;
max-width: 60rem;
margin: 0 auto;

#stage-caption h1 {
color: white;
font-weight: bold;
text-transform: uppercase;

For now it looks like that:

enter image description here

Thanks in advance!

Answer Source

Add text-align:center to #stage

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download