How to leave the text at the center of the css3 ellipse?

2

How to leave this text in the middle?

css:

<style>
    .bg-maroon, .bg-aqua, .bg-yellow, .bg-red, .bg-teal, .bg-purple, .bg-orange, .bg-green {
        text-align: center;
        height: 70px;
        border-radius: 50px;

    }
    .row span {
        display: block;
        margin-left: auto;
        margin-right: auto;
        font-size: 18px;

    }
</style>
    
asked by anonymous 19.09.2018 / 16:24

1 answer

5

There are several ways to do this, but in this case I think the ideal is to use a line height with the same height value, as you can see in the example with your code

.bg-maroon,
.bg-aqua,
.bg-yellow,
.bg-red,
.bg-teal,
.bg-purple,
.bg-orange,
.bg-green {
  text-align: center;
  height: 70px; /* altura do btn */
  border-radius: 50px;
  line-height: 70px; /* mesmo valor da altura do btn para ajustar no centro vertical */
}

.bg-maroon {
  background-color: brown;
  color: #fff;
}

.row span {
  display: block;
  margin-left: auto;
  margin-right: auto;
  font-size: 18px;

}
<div class="row">
	<span class="bg-maroon">bg-maroon</span>
</div>
    
19.09.2018 / 16:42