I want the Yellow Stars to completely obscure the blue stars
Could anyone help complete this? Or at least point to the right direction?
This is my code:
.star-ratings-css {
width: 100px;
}
.star-ratings-css-top {
display: block;
height: 22px;
position: relative;
overflow: hidden;
}
.star-ratings-css-bottom::before {
color: #167ac6;
content: "★★★★★";
font-size: 22px;
position: absolute;
}
.star-ratings-css-top::before {
color: #f4b414;
content: "★★★★★";
font-size: 22px;
position: relative;
}
<div class="star-ratings-css">
<div class="star-ratings-css-bottom"></div>
<div class="star-ratings-css-top" style="width: 31%"></div>
</div>
It does not work as I would like. What I am doing wrong?
Yellow stars do not completely cover the blue stars.
Just remove overflow: hidden;
and it will work like a charm. Below is an example for 4/5.
.star-ratings-css {
width: 100px;
}
.star-ratings-css-top {
display: block;
height: 22px;
position: relative;
}
.star-ratings-css-bottom::before {
color: #167ac6;
content: "★★★★★";
font-size: 22px;
position: absolute;
}
.star-ratings-css-top::before {
color: #f4b414;
content: "★★★★";
font-size: 22px;
position: relative;
}
<div class="star-ratings-css">
<div class="star-ratings-css-bottom"></div>
<div class="star-ratings-css-top" style="width: 31%"></div>
</div>
Try the "Inspect" feature of the Chrome browser to adjust CSS settings to what you want displayed.
The first two stars were made all yellow with the following changes.
Another option to get just two (2) yellow stars is ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With