This is a pretty easy task, but I need to find the correct syntax EVERY TIME.
The trick is to give an height to the container then use the vertical-align property.
Here’s the HTML:
some text
Here’s the CSS:
.container { background-color: rgba(0, 0, 0, 0.5); width: 200px; height: 130px; /* needed */ line-height: 130px; /* needed */ } .container img { vertical-align: middle; /* needed */ }