Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

html - Css rating with certain symbols

I want to create a rating system, but with certain symbol. It's similar to *, but it's not. How can I make that symbol?

Symbol

.rating-result {
    width: 265px;
    margin: 0 auto;
}
.rating-result span {
    padding: 0;
    font-size: 52px;
    margin: 0 3px;
    line-height: 1;
    color: lightgrey;
    text-shadow: 1px 1px #bbb;
}
.rating-result > span:before {
    content: '*';
}
.rating-result > span.active {
    text-shadow: 1px 1px #c60;
}
<div class="rating-result">
    <span class="active"></span>    
    <span class="active"></span>    
    <span class="active"></span>  
    <span></span>    
    <span></span>
</div>
question from:https://stackoverflow.com/questions/65849189/css-rating-with-certain-symbols

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

We can rotate the symbol by using CSS - transform: rotate(30deg)

.rating-result {
    width: 265px;
    margin: 0 auto;
}
.rating-result span {
    padding: 0;
    font-size: 52px;
    margin: 0 3px;
    line-height: 1;
    color: lightgrey;
    text-shadow: 1px 1px #bbb;
}
.rating-result > span:before {
    content: '?';
    display: inline-block;
    transform: rotate(30deg);
}
.rating-result > span.active {
    text-shadow: 1px 1px #c60;
}
<div class="rating-result">
    <span class="active"></span>    
    <span class="active"></span>    
    <span class="active"></span>  
    <span></span>    
    <span></span>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...