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

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

              
                <h1><a href="https://blog.hadcoffee.com" target="_blank">HadCoffee</a> 'Favouriting' Star UI</h1>

<div class='icon content'>
        <svg id='inlineStar' class="cananimate" width="44px" height="44px" viewBox="0 0 44 44" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <g id="star-group2" stroke="none" stroke-width="2" fill="none" fill-rule="evenodd">
                <path id="star-icon-outline" stroke="#FFBC5A" d="M34.26721,40.8843661 L31.9243814,27.224627 L41.8487628,17.550746 L28.133605,15.5578169 L22,3.12977573 L15.866395,15.5578169 L2.15123721,17.550746 L12.0756186,27.224627 L9.73278996,40.8843661 L22,34.4351121 L34.26721,40.8843661 Z"></path>
            </g>
            <path id="star-icon2" class="fillanim" opacity="0" stroke="none" fill="#FFBC5A" d="M34.26721,40.8843661 L31.9243814,27.224627 L41.8487628,17.550746 L28.133605,15.5578169 L22,3.12977573 L15.866395,15.5578169 L2.15123721,17.550746 L12.0756186,27.224627 L9.73278996,40.8843661 L22,34.4351121 L34.26721,40.8843661 Z"></path>
        </svg>
    </div>

<p>Click to Fav</p>
              
            
!

CSS

              
                body {
	padding: 0.5em 2em 2em;
	background: #48342b;
	color: #9e8f81;
  font-family: Raleway, 'Open Sans', Avenir, sans-serif;
}

h1 {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

a {color: #ecd5c0;}

div.icon {
    width: 44px;
    height: 44px;
    cursor: pointer;
}

div.icon img {
    height: auto;
}

.cananimate {
    transition: 0.4s ease-in;
}

.cananimate.active {
    transform: rotateZ(72deg);
}

/* Fill object transition */
path.fillanim {
    transition: 0.18s ease-in;
}
.active-fill {
    opacity: 1;
}
              
            
!

JS

              
                let star = document.getElementById('inlineStar');

star.addEventListener('click', function() {
  document.getElementById('inlineStar').classList.toggle('active');

        //CSS opacity directly on the fill path.
        document.getElementById('star-icon2').classList.toggle('active-fill');
});
              
            
!
999px

Console