cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="wrap">
  <span class="rate rate0"></span>
  <span class="rate rate1"></span>
  <span class="rate rate1-5"></span>
  <span class="rate rate2"></span>
  <span class="rate rate2-5"></span>
  <span class="rate rate3"></span>
  <span class="rate rate3-5"></span>
  <span class="rate rate4"></span>
  <span class="rate rate4-5"></span>
  <span class="rate rate5"></span>
</div>
            
          
!
            
              //レート評価 変数
$starFull: 16px;//星1個の幅
$starHalf: $starFull / 2;//星半分(0.5)の幅

$rate1: $starFull;//星1
$rate1-5: $starFull + $starHalf;//星1.5
$rate2: $starFull * 2;//星2
$rate2-5: ($starFull * 2) + $starHalf;//星2.5
$rate3: $starFull * 3;//星3
$rate3-5: ($starFull * 3) + $starHalf;//星3.5
$rate4: $starFull * 4;//星4
$rate4-5: ($starFull * 4) + $starHalf;//星4.5
$rate5 :$starFull * 5;//星5

.rate{
  position: relative;
  display: inline-block;
  width: $starFull * 5;
  height: $starFull;
  font-size: $starFull;
  &:before,&:after{
    position: absolute;
    top: 0;
    left: 0;
    content: '★★★★★';
    display: inline-block;
    height: $starFull;
    line-height: $starFull;
  }
  &:before{
  color: #ddd;
  }
  &:after{
  color: #ffa500;
  overflow: hidden;
  white-space: nowrap;//これがないと改行されて星の半分(0.5)が表現できなくなる
  }
}
.rate0:after{//星0
  width: 0;
}
.rate1:after{//星1
  width: $rate1;
}
.rate1-5:after{//星1.5
  width: $rate1-5;
}
.rate2:after{//星2
  width: $rate2;
}
.rate2-5:after{//星2.5
  width: $rate2-5;
}
.rate3:after{//星3
  width: $rate3;
}
.rate3-5:after{//星3.5
  width: $rate3-5;
}
.rate4:after{//星4
  width: $rate4;
}
.rate4-5:after{//星4.5
  width: $rate4-5;
}
.rate5:after{//星5
  width: $rate5;
}


.wrap{
  width: 80px;
  margin: 0 auto;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console