zemmsoares
zemmsoares

Reputation: 353

CSS Align text inside "shape"

I've been trying to change the position of the text inside the "Shape" but it allways keep pushing to the left.

bala {
  display: inline-flex;
  vertical-align: middle;
    height: 22px;
    width: 22px;
    line-height: 22px;

    -moz-border-radius: 30px;
    border-radius: 30px;

    background-color: black;
    color: white;
    font-size: 14px;
}
<p> <bala>21</bala> Done <MdError color='#fcb51b' /> In Progress:{inProgress} </p>

enter image description here

Upvotes: 0

Views: 295

Answers (2)

Friday Ameh
Friday Ameh

Reputation: 1684

Adding justify-content: center; Solves the problem.

bala {
  display: inline-flex;
  justify-content: center;
  vertical-align: middle;
    height: 22px;
    width: 22px;
    line-height: 22px;

    -moz-border-radius: 30px;
    border-radius: 30px;

    background-color: black;
    color: white;
    font-size: 14px;
}
<p> <bala>21</bala> Done <MdError color='#fcb51b' /> In Progress:{inProgress} </p>

Upvotes: 1

Ethan
Ethan

Reputation: 4375

Try changing display: inline-flex; to display: inline-block;, and then adding a text-align: center;:

bala {
  display: inline-block;
  vertical-align: middle;
  height: 22px;
  width: 22px;
  line-height: 22px;
  -moz-border-radius: 30px;
  border-radius: 30px;
  background-color: black;
  color: white;
  font-size: 14px;
  text-align: center;
}
<p>
  <bala>21</bala> Done
  <MdError color='#fcb51b' /> In Progress:{inProgress}
</p>

Upvotes: 0

Related Questions