I often use line-height for vertical centering the text within a inline-element.
I have made this demo:
body,
section {
  width: 100%;
}
section {
  background-color: lightGrey;
}
#wrap {
  margin: 30px auto;
  width: 100%;
  max-width: 800px;
  text-align: center;
  height: 48px;
}
.my-element {
  line-height: 48px;
}<section>
  <div id="wrap">
    <span class="my-element">My element</span>
  </div>
</section>Works fine. The text is exact vertically centered within the grey bar.
But the Problem with this approach is: I got to use the height of the parent-element and put it fixed in there.
Is there a better, a more dynamic approach, when using this pattern.
So that it doesn't become broken when the height of the parent-element changes.
 
     
    