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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <!-- GRID -->
<div class="wrapper">
	
	<!-- HEADER -->
	<p class="head">hover on the pictures</p>
	
	<!-- MAIN -->
	
	<!-- BLACK TO INVERT -->
	<div class="div black invert">
		<button><div></div></button>
		<p>black to <span>white</span></p>
	</div>
	<!-- BLACK TO COLOR -->
	<div class="div black color">
		<button><div></div></button>
		<p>black to <span>color</span>*</p>
	</div>
	
	<!-- WHITE TO INVERT -->
	<div class="div white invert">
		<button><div></div></button>
		<p>white to <span>black</span></p>
	</div>
	<!-- WHITE TO COLOR -->
	<div class="div white color">
		<button><div></div></button>
		<p>white to <span>color</span>*</p>
	</div>
	
	<!-- FOOTER -->
	<p class="foot">*Please, consider playing with the <span>$bg-color</span> and the <span>$color</span> in the CSS.  Changing to some colors will require more adjustements to work properly.</p>
	<p class="foot">See updated version <a href="https://codepen.io/salixdubois/pen/LYNgJbM">here</a> that uses mask instead</p>
	
</div>
<!-- THE END -->
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Lato")
@import "susy"
@import "breakpoint"
	
//== SETUP ==================================================
$bg: teal

@mixin hover($c)
	border: solid 1px $c
	background-color: rgba(0,0,0,0) //no bg, doesn't work with black Oo

//===========================================================
//== WHITE TO COLOR ========================================
//===========================================================

$icon-white: red 
white-span
	color: $icon-white
white
	@include hover($icon-white)
	&::before, &::after
		//-- for white you need to get the opposite color -------
		background: invert($icon-white)
//-----------------------------------------------------------

//-- UNCOMMENT TO TRY OTHER COLORS AND ADJUSTMENT -----------

//-- exemple with pink ------------------------------------
//$icon-white-adjust: pink //-- change & see below
//white-adjust-span
//	color: $icon-white-adjust
//white-adjust
//	@include hover($icon-white-adjust)
//	&::after
//		background: invert($icon-white-adjust)		
//	&::before
//		background: adjust-color($bg, $lightness: 12.3%, $hue: -3)
//		mix-blend-mode: normal
//-----------------------------------------------------------

//-- exemple with goldenrod -------------------------------
//$icon-white-adjust: goldenrod //-- change & see below
//white-adjust-span
//	color: $icon-white-adjust
//white-adjust
//	@include hover($icon-white-adjust)
//	&::after
//		background: invert($icon-white-adjust)		
//	&::before
//		background: adjust-color($bg, $hue: -38, $saturation: -30, $lightness: 25.5)
//		mix-blend-mode: normal
//-----------------------------------------------------------

//===========================================================
//== BLACK to COLOR ========================================
//===========================================================

$icon-black: cyan
black-span
	color: $icon-black
black
	@include hover($icon-black)
	&::before, &::after
		background: $icon-black
//-----------------------------------------------------------

//-- uncomment this section to check the adjustments --------
$icon-black-adjust: goldenrod
//black-adjust-span
//	color: $icon-black-adjust
//black-adjust
//	@include hover($icon-black-adjust)
//	&::before
//		background: change-color($bg, $hue: 295, $lightness: 84.5%)
//		mix-blend-mode: difference
//	&::after
//		background: $icon-black-adjust
//-----------------------------------------------------------

//===========================================================
//== IMAGES STYLING =========================================
//===========================================================

//== BLACK ==================================================
.black
	color: black
	button
		@include hover(black)
		div
			background: url("https://upload.wikimedia.org/wikipedia/commons/b/b9/FP_Mushroom_icon.svg") center no-repeat
			background-size: contain

//-- TO INVERT ----------------------------------------------
.black.invert
	span
		color: white
	button
		&:hover
			@include hover(white)
			&::before, &::after
				background-color: white

//-- TO COLOR -----------------------------------------------
.black.color
	span
		@extend black-span
		@extend black-adjust-span !optional
	button
		&:hover
			@extend black
			@extend black-adjust !optional
//-----------------------------------------------------------

//== WHITE ==================================================

.white
	color: white
	button
		@include hover(white)
		div
			background: url(https://upload.wikimedia.org/wikipedia/commons/d/db/Sun_white_icon.svg) center no-repeat
			background-size: contain

//-- TO INVERT ----------------------------------------------
.white.invert
	span
		color: black
	button
		&:hover
			@include hover(black)
			&::before, &::after
				//-- for white you need the opposite color ---------
				background-color: white

//-- TO COLOR -----------------------------------------------
.white.color
	span
		@extend white-span
		@extend white-adjust-span !optional
	button
		&:hover
			@extend white
			@extend white-adjust !optional
//-----------------------------------------------------------


//===========================================================
//== RESPONSIVE GRID SUZY+BREAKPOINT========================
//===========================================================

$bp0: 0px
$bp1: 450px
$bp2: 600px
$bp3: 800px
$bp4: 1000px

$susy: (gutters: 1/4, gutter-position: split)
//-----------------------------------------------------------

.wrapper
	width: 90%
	@include breakpoint($bp0)
		min-width: (0.9*$bp1)
	@include breakpoint($bp1)
		max-width: (0.8*$bp2)
	@include breakpoint($bp2)
		max-width: (0.6*$bp3)
	@include breakpoint($bp3)
		max-width: (0.9*$bp4)
//-----------------------------------------------------------
		
.foot
	@include span(100%)
	@include breakpoint($bp0)
		font-size: 10px
	@include breakpoint($bp1)
		font-size: 11px
	@include breakpoint($bp2)
		font-size: 12px
	@include breakpoint($bp3)
		font-size: 14px
	@include breakpoint($bp4)
		font-size: 16px
//-----------------------------------------------------------

.head
	@include span(100%)
	@include breakpoint($bp0)
		font-size: 24px
		margin: 5% 0
	@include breakpoint($bp1)
		font-size: 26px
		margin: 3% 0
	@include breakpoint($bp2)
		font-size: 30px
		margin: 3% 0
	@include breakpoint($bp3)
		font-size: 36px
		margin: 5% 0
//-----------------------------------------------------------
	
.div
	@include span(1 of 2)
	@include breakpoint($bp0)
		font-size: 13px
	@include breakpoint($bp1)
		font-size: 14px
	@include breakpoint($bp2)
		font-size: 15px
	@include breakpoint($bp3)
		font-size: 16px
		@include span(1 of 4)
		margin-bottom: gutter(4)

//===========================================================
//== GENERAL STYLING =======================================
//===========================================================

html, body
	height: 100%
	width: 100%
	background-color: $bg
	font-family: 'Lato', sans-serif
	text-transform: uppercase
	text-align: center
	.wrapper
		height: 100%
		margin: 0 auto
		position: relative
		.head
			font-weight: bold
			text-shadow: -1px -1px lighten($bg, 16%), -1px 0 lighten($bg, 10%), 0 -1px lighten($bg, 10%), 1px 0 darken($bg, 10%), 1px 1px darken($bg, 16%), 0 1px darken($bg, 10%)
			color: lighten($bg, 4%)
			letter-spacing: 4px
		.div
			position: relative
			&::before
				padding-top: 100%
				display: block
				content: ""
			p
				position: absolute
				bottom: 0
				left: 0
				width: 100%
			button
				position: absolute
				top: 0
				left: 10%
				cursor: pointer
				width: 80%
				height: 75%
				padding: 10% 0
				div
					height: 100%
					position: relative
				&::after, &::before
					mix-blend-mode: difference
					position: absolute
					top: 0
					left: 0
					width: 100%
					height: 100%
					content: ""
	.foot
		span
			font-weight: bold
	
//== THE END ================================================
              
            
!

JS

              
                /*        
						Guess some updates made it 
				not work as well as it used too, 
					will have to figure the color 
											again 
*/

              
            
!
999px

Console