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

              
                <p>Hover/click on the top or the bottom of the button to like/dislike.</p>
<div class='btn-like'>
	<div class='thumbs-up'>
		<i class="fa fa-thumbs-up" aria-hidden="true"></i>
	</div>	
</div>	
              
            
!

CSS

              
                *
	box-sizing: border-box



body
	min-height: 100vh
	display: flex
	flex-direction: column
	justify-content: center
	align-items: center
	background: linear-gradient(-45deg, #8FBC94, lighten(#8FBC94, 5%))

p
	font-weight: 700
	font-family: 'Raleway', sans-serif

.btn-like
	width: 75px
	height: 75px
	background: #2EC4B6
	display: flex
	flex-direction: column
	justify-content: center
	align-items: center
	border-radius: 100%
	transition: 0.35s ease-in-out
	cursor: pointer
	box-shadow: 0px 0px 25px 5px rgba(black, 0.35)
	overflow: hidden
	position: relative
	.circle
		width: 0
		height: 0
		border-radius: 100%
		
	&.top
		background: #2EC4B6
		.thumbs-up
			transform: rotate(0deg)
	&.bottom
		background: #E71D36
		.thumbs-up
			transform: rotate(180deg)
	.thumbs-up
		transition: 0.35s ease-in-out
		.fa
			font-size: 25px
			color: white
			&::before
				display: block
				text-shadow: 0px 0px 10px rgba(black, 0.75)

              
            
!

JS

              
                $(".btn-like").on('mousemove click', function(e){
	var $this = $(this),
			pos = e.pageY - $this.offset().top;
	
	if (pos >= $this.height() / 2){
		$this.removeClass("top");
		$this.addClass("bottom");
	}else if (pos < $this.height() / 2){
		$this.addClass("top");
		$this.removeClass("bottom");
	}
	
	
}); 
              
            
!
999px

Console