I am trying to create a white box centered, both horizontally and vertically, within a div with a background image.
I have managed to center it horizontally as seen below in the "center"-class, but not vertically. I have tried to set "bottom" for the "filter-box"-class to the desired value and tried to use line-height and vertical align - all without the box even moving.
.image-container {
background: url('stubbe.jpg') no-repeat fixed;
height: 40em;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
line-height: 20em;
}
.filter-box {
background-color: white;
width: 500px;
height: 100px;
vertical-align: middle;
}
.center {
margin: auto;
width: 50%;
}
html
<div class="image-container">
<div class="filter-box center">
</div>
</div>