I am trying to make the I rate it ??/?? to be perfectly aligned in the center and floating in the left, so the I rate it ??/?? word(s) will have a perfect vertical shape. When I do it, the float statement breaks the block level element and go outside of it. This is an example:
li {
display: block;
background: green;
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
padding: 20px 0px 20px 10px;
}
span.rate {
color: #fff;
margin-right: 65px;
padding: 20px 10px;
float: right;
background: rgb(10, 10, 10);
}
<ol>
<li>Text1<span class="rate">I rate it 10/10</span></li>
<li>Text2 Text Text Text Text Text<span class="rate">I rate it 6/10</span></li>
<li>Text5<span class="rate">I rate it 9/10</span></li>
<li>Text9 Text Text<span class="rate">I rate it 2/10</span></li>
</ol>
Here is another example, but without the float statement. It looks perfect, but without the float: right; statement, it's not vertically aligned at all. It's not perfectly aligned like the first one:
li {
display: block;
background: green;
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
padding: 20px 0px 20px 10px;
}
span.rate {
color: #fff;
margin-right: 65px;
padding: 20px 10px;
background: rgb(10, 10, 10);
}
<ol>
<li>Text1<span class="rate">I rate it 10/10</span></li>
<li>Text2 Text Text Text Text Text<span class="rate">I rate it 6/10</span></li>
<li>Text5<span class="rate">I rate it 9/10</span></li>
<li>Text9 Text Text<span class="rate">I rate it 2/10</span></li>
</ol>
In the end. I want the I rate it ??/?? to be:
1- Perfectly align vertically.
2- Perfectly fit inside the block level element.