Display Star in Front End based on rating

前端 未结 5 1652
名媛妹妹
名媛妹妹 2021-01-29 09:49

I have created a field in backend where using radio button am selecting the rating of product as 1 star, 2 star, 3 star, 4 star and 5 Star

In front end when displaying s

5条回答
  •  温柔的废话
    2021-01-29 10:31

    This solution uses hidden radio buttons. The label is presented as a star thanks to fontAwesome. The value of the star can be sent to your PHP script or you can set the correct star based on any value you have.

    input[type="radio"] {
      display: none;
    }
    
    label {
      display: inline-block;
    }
    
    input[type="radio"]:checked+label {
      cursor: default;
      color: red;
    }
    
    

提交回复
热议问题