qweeee
qweeee

Reputation: 63

How to ensure span's content grow to the right instead of left in CSS

I have a span tag and have such css styles:

position: absolute;
top: 5px;
right: 125px;
font-size: 9px;
color: #fff;
font-weight: 700;
background-color: #19b385;
display: inline-block;
padding: 1px 5px;
min-width: 12px;
border-radius: 50px;
user-select: none;

But the problem is if I add more and more content like <span>100000</span> then it grows to the left but I want it to grow to the right

Upvotes: 0

Views: 436

Answers (1)

Sean
Sean

Reputation: 975

If you set the left position value instead of the right then it will be fixed at the left side so should grow to the right.

Try left: calc(100% - 125px) or something like that.

Upvotes: 1

Related Questions