I have a section that automatically displays a list of post titles from WordPress, I have added the custom list number styled, but unfortunately based on the max-width of this section makes problem on making equal width and height of custom numbers
Live demo on codepen list numbers
HTML
<ol>
<li>Lorem ipsum dolor sit amet.</li>
<li>Tempore nostrum laborum sequi obcaecati.</li>
<li>Illo iusto dolores magnam ratione!</li>
<li>Illo iusto dolores magnam ratione!</li>
<li> Amet odio rerum alias impedit! Amet odio rerum alias impedit! gooba astonishing</li>
</ol>
CSS
ol {
max-width: 350px;
list-style: none;
counter-reset: my-awesome-counter;
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
}
ol li {
counter-increment: my-awesome-counter;
display: flex;
width: 100%;
font-size: 0.8rem;
margin-bottom: 0.5rem;
}
ol li::before {
content: counter(my-awesome-counter);
margin-right: 0.5rem;
font-family: Raleway;
font-style: normal;
font-weight: bold;
font-size: 18px;
background: #29C9CE;
width: 45px;
height: 45px;
align-items: center;
text-align: center;
display: flex;
justify-content: center;
}
Always the result of numbers should be like this below
Note: in codepen above the number will have different width when the title is too long
How to solve this? any idea will be great
UPDATE FOR FUTURE REFERENCE
centering vertically the numbers with font Raleway is no brainer we need to use a different font to solve the problem or tweek it as pointed in a thread below like by adding this -webkit-font-feature-settings: "lnum";
Thanks to @shadow-lad for pointing this out I spend few hours trying to solve this damn
source: What is wrong with raleway