Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <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>
              
            
!

CSS

              
                //レート評価 変数
$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;
}
              
            
!

JS

              
                
              
            
!
999px

Console