I've a problem with vertical centering my H2 and H4 elements into div which has 50% border radius. It looks like:
Of course I would like to center this text even on small devices. I had a problem with centering rounded div's so I use for them display: table, so I fear that it determine that I can't center text in easy way. Do you have any ideas?
.meals
{
width: 100%;
margin-top: 60px;
display: flex;
}
@media screen and (max-width: 600px)
{
.meals
{
flex-direction: column;
align-items: center;
}
.meals-box
{
width: 100%;
display: table;
position: relative;
}
}
@media screen and (min-width: 600px) and (max-width: 960px)
{
.meals
{
flex-direction: row;
flex-wrap: wrap;
}
.meals-box
{
width: 50%;
display: table;
position: relative;
}
}
@media screen and (min-width: 960px)
{
.meals
{
flex-direction: row;
}
.meals-box
{
width: 25%;
display: table;
position: relative;
}
}
.burgers-overlay
{
background: url(img/Burger-Craft-139.jpg);
height: 300px;
background-size: cover;
background-position: center;
display: table-cell;
vertical-align: middle;
}
.hot-dogs-overlay
{
background: url(img/Burger-Craft-123.jpg);
height: 300px;
background-size: cover;
background-position: center;
display: table-cell;
vertical-align: middle;
}
.bowls-overlay
{
background: url(img/Burger-Craft-72.jpg);
height: 300px;
background-size: cover;
background-position: center;
display: table-cell;
vertical-align: middle;
}
.salads-overlay
{
background: url(img/Burger-Craft-44.jpg);
height: 300px;
background-size: cover;
background-position: center;
display: table-cell;
vertical-align: middle;
}
.meals-text
{
background-color: #FFF;
border-radius: 50%;
width: 170px;
height: 170px;
box-shadow: 1px 1px 5px #000;
margin: 0 auto;
}
.meals-text h2, .meals-text h4
{
text-align: center;
}
<section class="meals">
<div class="meals-box">
<div class="burgers-overlay">
<div class="meals-text">
<h2>Burgers</h2>
<h4>View menu</h4>
</div>
</div>
</div>
<div class="meals-box">
<div class="hot-dogs-overlay">
<div class="meals-text">
<h2>Hot dogs</h2>
<h4>View menu</h4>
</div>
</div>
</div>
<div class="meals-box">
<div class="bowls-overlay">
<div class="meals-text">
<h2>Bowls</h2>
<h4>View menu</h4>
</div>
</div>
</div>
<div class="meals-box">
<div class="salads-overlay">
<div class="meals-text">
<h2>Salads</h2>
<h4>View menu</h4>
</div>
</div>
</div>
</section>