I have 2 columns with responsive background images and text overlays vertically centered. How can I make the text overlay behave responsive according to the automatically resizing of the images? In other words, the text should always be vertically centered based on image height.
The problem I am having is that I had to define a height to make the text vertically aligned in the first place (e.g. try removing the height, the text will align top). When changing screen width, the 300px height of the background is ignored (intentional) with 'background-size: 100% auto;'. But that does not apply to the text, as it is keeps centering on the 300px height. How can I solve that without using various media queries for different sizes?
.two-pics-1 {
background-image: url('http://via.placeholder.com/1000x500');
background-position: center top;
background-size: 100% auto;
background-repeat: no-repeat;
height: 300px;
}
.two-pics-2 {
background-image: url('http://via.placeholder.com/1000x500');
background-position: center top;
background-size: 100% auto;
background-repeat: no-repeat;
height: 300px !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<div class="container">
<div class="row mb-5">
<div class="col-md-6 mb-3">
<div class="container">
<div class="row two-pics-1">
<div class="col-md-12 text-center my-auto">
<h2>Setup & Support</h2>
</div>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="container">
<div class="row two-pics-2">
<div class="col-md-12 text-center my-auto">
<h2>Tech Specs</h2>
</div>
</div>
</div>
</div>
</div>
</div>