Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
  <symbol id="starIcon" viewBox="0 0 24 24">
  <polygon points="12,0 15.708,7.514 24,8.718 18,14.566 19.416,22.825 12,18.926 4.583,22.825 6,14.566 0,8.718 8.292,7.514"/>
  </symbol>
</svg> 
<div class="container">
  <div class="row">
    <fieldset class="rating">
      <legend>Please rate:</legend>
      <input type="radio" id="star5" name="rating" value="5" />
      <label for="star5" title="Rocks!">
        <svg class="icon icon-star">
          <use xlink:href="#starIcon" />
        </svg>
      </label>
      <input type="radio" id="star4" name="rating" value="4" />
      <label for="star4" title="Pretty good">
        <svg class="icon icon-star">
          <use xlink:href="#starIcon" />
        </svg>
      </label>
      <input type="radio" id="star3" name="rating" value="3" />
      <label for="star3" title="Meh">
        <svg class="icon icon-star">
          <use xlink:href="#starIcon" />
        </svg>
      </label>
      <input type="radio" id="star2" name="rating" value="2" />
      <label for="star2" title="Kinda bad">
        <svg class="icon icon-star">
          <use xlink:href="#starIcon" />
        </svg>
      </label>
      <input type="radio" id="star1" name="rating" value="1" />
      <label for="star1" title="Sucks big time">
        <svg class="icon icon-star">
          <use xlink:href="#starIcon" />
        </svg>
      </label>
    </fieldset>
  </div>
</div>


</div>
              
            
!

CSS

              
                $yellow: #fc0;
$yellow-bright: #fd0;
$grey-light: #ccc;
$grey: #bbb;

.row {
  overflow: auto;
  clear: both;
}

.rating {
  float:left;
  border: 1px solid #ddd;
  margin: 1em;
  padding: .75em 1em;
}

.rating label {
  width: 2em;
}

// :not(:checked) is a filter, so that browsers that don’t support :checked don’t
//   follow these rules. Every browser that supports :checked also supports :not(), so
//   it doesn’t make the test unnecessarily selective */
.rating:not(:checked) > input {
    position:absolute;
    top:-9999px;
    clip:rect(0,0,0,0);
}

.rating:not(:checked) > label {
    float: right;
    width: 2em;
    padding: 0 .1em;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    line-height:1.2;
}

.icon-star {
  width: 2em;
  height: 2em;
  fill: $grey-light; // #ccc;
  transition: all .3s;
  pointer-events: none; // Fix for FireFox, see comment: Thanks Paul Dolby! https://codepen.io/SuperHands
}

.rating > input:checked ~ label .icon-star {
  fill: $yellow; // #fc0;
}

.rating:not(:checked) > label:hover .icon-star ,
.rating:not(:checked) > label:hover ~ label .icon-star  {
  fill: $grey //#bbb;
}

.rating > input:checked + label:hover .icon-star,
.rating > input:checked + label:hover ~ label .icon-star,
.rating > input:checked ~ label:hover .icon-star,
.rating > input:checked ~ label:hover ~ label .icon-star,
.rating > label:hover ~ input:checked ~ label .icon-star {
  fill: $yellow-bright; // #fd0;
}

.rating > label:active {
    position:relative;
    top: 1px;
    left: 1px;
} 
              
            
!

JS

              
                
              
            
!
999px

Console