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

              
                .luchador.u-inline.u-relative
	.luchador__forehead
	.luchador__eye
	.luchador__eye.luchador__eye--mirror
	.luchador__nose
	.luchador__mouth.u-inline.u-relative
span.c-emoji.u-relative 🔥 🔥 🔥 

form.c-form.u-inline(method="post" action="")
	fieldset.c-form__fieldset
		legend.c-form__title.u-uppercase Ask Luchador
		
		.c-field
			input(type="text" name="name" placeholder="Name" value="" required).c-field__input
			label(for="name").c-field__label.u-uppercase Name

		.c-field
			input(type="email" name="email" placeholder="Email" maxlength="255" value="" required).c-field__input
			label(for="email").c-field__label.u-uppercase Email

		.c-field
			input(type="text" name="subject" placeholder="What's up?" value="").c-field__input
			label(for="subject").c-field__label.u-uppercase Subject

		.c-field
			textarea(name="msg" rows="6" cols="50" placeholder="Ask me anything!" required).c-field__textarea
			label(for="msg").c-field__label.u-uppercase Message
			
		.c-field
			input(type="submit" value="Hit me").c-btn.u-uppercase
              
            
!

CSS

              
                :root {
	// COLOR CSS VARIABLES
	--color_luchador: #dcdcdc; // Silver
	--color_outline: #b5b5b4; // Dark Silver
	--color_txt: white;
	
	// Color Palette Pink
	// Default
	// --color_base: #e7515d; // Pink
	// --color_accent: #B64861; // Dark Pink
	
	// Color Palette Purple
	// Uncomment the following 2 variables to activate:
	// --color_base: #72209e; // Purple
	// --color_accent: #4a0461; // Dark Purple
	
	// Color Palette Blue
	// Uncomment the following 2 variables to activate:
	--color_base: #048cc7; // Blue
	--color_accent: #13579c; // Dark Blue
	
	// Color Palette Orange
	// Uncomment the following 2 variables to activate:
	// --color_base: #f07346; // Orange
	// --color_accent: #c25323; // Dark Orange
}

// ILLUSTRATION SIZE VARIABLES
$luchador: 100px; // Resize luchador by editing only this variable 
$luchador_h: round($luchador * 1.2);
$eye: round($luchador / 3.3);
$eye_half: round($eye / 2);
$nose: round($eye / 1.5);
$nose_h: round($nose / 2);
$mouth: round($luchador / 2.3);
$mouth_h: round($eye_half * 1.4);
$border: round($luchador / 20);
$bottom: round($eye / 1.5);
$line: round($luchador / 50);

// MIXINS
@mixin size($w, $h: $w) {
  width: $w;
  height: $h;
}

// FUNCTION FROM PX TO REM
// Taken from stubbornella's blog
// http://www.stubbornella.org/content/2013/07/01/easy-peasy-rem-conversion-with-sass/
@function rem($size) {
	$remSize: ($size / 16px);
	@return #{$remSize}rem;
}

// BASE
* {
	box-sizing: border-box;
}

body {
	min-width: rem(320px);
	background-color: var(--color_base);
	text-align: center;
}

::placeholder {
	color: var(--color_base);
	opacity: 1; // Needed for Firefox
}

// PATTERNS (UTILITY)
.u-inline {
	display: inline-block;
}

.u-relative {
	position: relative;
}

.u-uppercase {
	text-transform: uppercase;
}

// ILLUSTRATION
.luchador {
	@include size($luchador, $luchador_h);
	background-color: var(--color_luchador);
	border-radius: 48%;
	cursor: pointer;
	margin-top: $eye_half;
	overflow: hidden;
	
	// We want to avoid a jerky hover effect
	> *,
	+ .c-emoji {
		pointer-events: none;
	}
	
	&__forehead {
		@include size(100%, $nose);
		border-bottom: $line solid var(--color_outline);
				
		.luchador:hover & {
			height: round($nose / 1.2);
		}
	}
	
	&__eye {
		@include size($eye);
		background-color: var(--color_base);
		border-radius: 0 $eye_half $eye_half;
		border: $border solid var(--color_outline);
		position: absolute;
		top: round($eye * 1.15);
		transform: rotate(10deg);
				
		.luchador:hover & {
			background-color: var(--color_accent);
			top: round($eye * 1.1);
		}
		
		&:not(&--mirror) {
			left: $eye_half;
		}
		
		&--mirror {
			right: $eye_half;
			transform: rotate(-10deg) scaleX(-1);
		}
	}
	
	&__nose {
		@include size($nose, $nose_h);
		border-top-left-radius: $nose_h;
		border-top-right-radius: $nose_h;
		background-color: var(--color_base);
		display: block;
		margin: round($luchador / 2.2) auto 0;
		
		.luchador:hover & {
			margin-top: round($luchador / 2.4);
		}
	}
	
	&__mouth {
		@include size($mouth, $mouth_h);
		background-color: var(--color_base);
		border-radius: $eye_half;
		border: $border solid var(--color_outline);
		margin-top: $border;
		transition: all 0.05s linear;
		z-index: 10;
			
		.luchador:hover & {
			width: round($luchador / 2.5);
			height: round($eye_half * 1.6);
			background-color: var(--color_accent);
			margin-top: round($border / 2);
		}
	}
	
	&:after {
		@include size($bottom);
		background-color: var(--color_outline);
		border-radius: 0 $eye_half $eye_half;
		content: '';
		margin-left: -(round($bottom / 2));
		position: absolute;
		left: 50%;
		bottom: round($eye_half / 1.4);
		transform: rotate(-135deg);
		z-index: 0;
	}
}

.c-emoji {
	font-size: $nose;
	font-weight: normal;
	display: block;
	transition: all 1s linear, 
				opacity 0.01s linear;
	opacity: 0;
	z-index: 20;
	
	.luchador:hover + & {
		opacity: 1;
		transform: translateY(-($luchador * 2));
	}
}

// FORM VARIABLES
$legend: round($luchador / 2);
$bp_m: rem(round($luchador * 6.5));
$border_form: $border;
$border_form_2x: round($border_form * 2);
$input: round($luchador / 8);
$padding: 3%;
$transition: 0.15s ease-in-out;
$width_form_sm: 90%;
$width_form_md: 70%;

// FORM
.c-form {
	max-width: $bp_m;
	width: 90%;
	font-family: 'Barlow Semi Condensed', sans-serif;
	color: var(--color_txt);
	margin-top: -(round($legend / 1.8));
	
	&__fieldset {
		border-color: rgba(0,0,0, 0.1);
		border-radius: $border_form;
	}
	
	&__title {
		font-size: rem($legend);
		font-weight: 900;
		letter-spacing: $border_form;
		line-height: 1;
		
		@media (min-width: $bp_m) {
			font-size: rem(round($legend * 1.5));
		}
	}
}

.c-field {
	width: $width_form_sm;
	display: flex; // To use the order property in children
	flex-direction: column;
	margin: 0 auto;
		
	@media (min-width: $bp_m) {
		width: $width_form_md;
	}
	
	&__label {
		width: 100%;
		font-size: rem(round($input * 1.2));
		font-weight: 600;
		order: -1; // To place label over the input field/textarea, and still be able to style them using the adjacent sibling combinator '+'
		margin-bottom: $border_form_2x;
		padding-left: $padding;
		text-align: left;
		opacity: 0; // To blend in labels on input:focus
		// transition: opacity $transition; // Don't love it yet... should I use it?
	}
	
	&__input {
		@include size(100%, $legend);
		border: 0;
		border-radius: $border_form_2x;
		color: var(--color_base);
		font-size: rem($input);
		font-weight: 800;
		padding: $padding;
		transition: background $transition;
		
		&:focus {
			color: var(--color_txt);
			background-color: var(--color_accent);
			font-size: rem(round($input * 1.5));
			font-weight: 700;
			letter-spacing: round($border_form / 4);
			outline: 0;
			
			// Let's hide the placeholder 
			&::placeholder {
				color: var(--color_accent);
				visibility: hidden;
			}
			
			+ .c-field__label {
				margin-top: round($border_form_2x * 2);
				opacity: 1;
			}
		}
	}
	
	&__textarea {
		@extend .c-field__input;
		height: auto;
		margin-bottom: round($border_form_2x * 2);
		resize: none;
	}
}

.c-btn {
	@include size(100%, $legend);
	appearance: none;
	border-radius: round($border_form * 2);
	background-color: rgba(0,0,0, 0.05);
	border: 0;
	color: var(--color_txt);
	cursor: pointer;
	font-size: rem(round($input * 1.3));
	font-weight: 700;
	margin-bottom: round($border_form_2x * 2);
	outline: 0;
	transition: background $transition;
	
	&:focus,
	&:hover {
		background-color: var(--color_luchador);
		color: var(--color_accent);
		font-size: rem(round($input * 1.5));
		font-weight: 800;
		letter-spacing: round($border_form / 4);
	}
}
              
            
!

JS

              
                /* 
 * PURE CSS CONTACT FORM + ILLUSTRATION 
 * Resizable contact form with just 1 Sass edit.
 * Yes! Each component in this contact form, including the illustration can be resizable with a simply variable change.
 *
 * Contact form built during a CSS Workshop on Sat. Nov.25, 2017 @ Google Developer Group Devfest Hamburg.
 *
 * This is a rebound pen, inspired after my original illustration from #codevember - Fight “El Santo”.
 * https://codepen.io/ilithya/pen/EbEdWx
 *
 * You can hover luchador to see him angry.
 *
 * By ilithya | 2017
 */
              
            
!
999px

Console