You have four options:
- Make all grey blocks longer
- Give each grey block a dynamic
width
- Make all the text smaller
- Give each text a dynamic
font-size
Options 1) and 3) have the advantage of giving your page a uniform appearance.
Options 2) and 4) have the advantage of only altering the appearance of a grey block (and the text it contains) when necessary.
If you declare display: inline-block
for a div
and do not explicitly set a width
for that div
, then it will have an implicit width based on its content. See below for an example.
Working Example using dynamic widths:
div {
position: relative;
display: inline-block;
margin: 12px 6px;
padding: 12px;
font-size: 24px;
text-align: center;
color: rgb(0, 127, 0);
background-color: rgb(227, 227, 227);
border-radius: 6px;
}
<div>3000₽</div>
<div>300000₽</div>
<div>300000000₽</div>