cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              - var initial_hue = 35;
- var cats = ['tiger', 'lion', 'leopard', 'jaguar', 'cheetah', 'cougar'];
- var n_cats = cats.length

body(style=`--hue: ${initial_hue}`)
	header
		h1 Cats!
	main
		form
			input(type='range' id='hue' value=`${initial_hue}` max='360')
			label(for='hue') hue
		- for(var i = 0; i < n_cats; i++) {
			section
				header
					h2 #{cats[i]}
				p some description
		- }
	footer
		div something
            
          
!
            
              @mixin palette($n: 4) {
	$unit-perc: 100%/($n + 1);
	$lum-unit-perc: round(.5*$unit-perc);

	@for $i from 1 through $n {
		$off: $i*$unit-perc;
		$lum-off: $i*$lum-unit-perc;
		--tint#{$i}: hsl(calc(var(--hue)), 100%, 50% + $lum-off);
		--shade#{$i}: hsl(calc(var(--hue)), 100%, 50% - $lum-off);
		--tone#{$i}: hsl(calc(var(--hue)), 100% - $off, 50%);
	}
}

@mixin track($track-w, $track-h) {
	border: none;
	width: 100%; height: $track-h;
  border-radius: $track-h/2;
	background: dimgrey;
}

@mixin fill() {
	background: currentcolor;
}

@mixin thumb($thumb-d) {
	box-sizing: border-box;
  border: solid .25em var(--main-bg);
  width: $thumb-d; height: $thumb-d;
  border-radius: 50%;
  background: currentcolor;
	transition: .3s ease-out;
}

@mixin thumb-focus() {
	border-width: 0;
}

@mixin slider($input-lat, $track-w, $track-h, $thumb-d) {
	order: 2;
	margin: 0 .5em;
	border: solid 0 transparent;
	border-width: $input-lat;
	width: $track-w; height: 6*$track-h;
	background: transparent;
	color: dimgrey;
	cursor: pointer;

	&::-webkit-slider-runnable-track, 
	&::-webkit-slider-thumb, & {
		-webkit-appearance: none
	}

	&::-webkit-slider-runnable-track {
		@include track($track-w, $track-h);
	}

	&::-moz-range-track {
		@include track($track-w, $track-h);
	}

	&::-ms-track {
		color: transparent;
		@include track($track-w, $track-h);
	}

	&::-moz-range-progress {
		@include fill();
	}

	&::-ms-fill-lower { 
		@include fill();
	}

	&::-webkit-slider-thumb {
		margin-top: .5*($track-h - $thumb-d);
		@include thumb($thumb-d);
	}

	&::-moz-range-thumb {
		@include thumb($thumb-d);
	}

	&::-ms-thumb { 
		margin-top: initial;
		@include thumb($thumb-d);
	}

	&:focus {
		outline: none;
		color: var(--base);

		&::-webkit-slider-thumb {
			@include thumb-focus();
		}

		&::-moz-range-thumb {
			@include thumb-focus();
		}

		&::-ms-thumb { 
			@include thumb-focus();
		}
		
		+ label { color: var(--tint2) }
	}

	+ label {
		order: 1;
		margin: 0 .5em;
	}
}

@mixin cats($cats) {
	$n-cats: length($cats);
	
	@for $i from 1 through $n-cats {
		$curr: nth($cats, $i);
		
		&:nth-of-type(#{$i}) {
			background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/2017/17_07_art_#{nth($curr, 1)}.jpg') #{nth($curr, 2)}/cover currentcolor;
		}
	}
}

* { margin: 0; font: inherit }

body {
	--lh: 2;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100vh;
	--base: hsl(calc(var(--hue)), 100%, 50%);
	--main-bg: black;
	background: var(--main-bg);
	@include palette;
	font: 1em/ var(--lh) trebuchet ms, sans-serif;
}

header {
	overflow: hidden;
	position: relative;
	--range: 100vw;
	width: var(--range);
	--over: 15em;
	background: var(--main-bg);
	--rel: 5em;
	text-align: center;
	isolation: isolate;
	
	main & {
		display: inline-table;
		--range: 8em;
		--over: calc(.75*var(--range));
		--rel: 1.5em
	}
	
	&:before {
		position: absolute;
		right: calc(var(--range) + 3em);
		width: var(--over); height: calc(var(--lh)*var(--rel));
		--shape: skewx(-20deg);
		transform: var(--shape) translate(0);
		background: var(--tint4);
		transition: 3s cubic-bezier(0,1.25,1,-0.25);
		content: ''
	}
	
	&:hover:before {
		transform: var(--shape) translate(calc(var(--range) + 6em + 100%))
	}
}

h1, h2 {
	display: inline-block;
	padding: 0 1em;
	color: white;
	font-size: var(--rel);
	mix-blend-mode: difference;
	text-shadow: 1px 1px 1px var(--tint3)
}

h1 {
	padding: 0;
	font-family: rancho, cursive;
	font-style: italic;
	font-weight: 900
}

main {
	flex: 1;
	display: grid;
	grid-gap: 8px;
	grid-template: auto repeat(2, 1fr)/ repeat(3, 1fr);
	padding-bottom: 8px;
	
	@media (max-width: 500px) {
		grid-template: auto repeat(3, 1fr)/ repeat(2, 1fr);
		
		h2 { padding: 0 .75em }
	}
	
	@media (max-width: 300px) {
		grid-template: auto repeat(6, 1fr)/ 1fr;
	}
}

form {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	padding: .5em 0;
	color: dimgrey;
	font-size: 1.25em;
}

input[type='range'] {
	@include slider(.5em, 9em, .25em, 1.125em);
}

section {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
	@include cats((tiger 50%) (lion (33% 40%)) (leopard (50% 33%)) (jaguar (80% 20%)) (cheetah (30% 25%)) (cougar (67% 25%)));
	color: var(--tone4);
	background-blend-mode: luminosity;
	
	&:nth-of-type(2n) { color: var(--tone3) }
}

p {
	margin-top: .5em;
	padding: .5em;
	background: rgba(white, .85);
	color: var(--shade3);
}

footer {
	padding: .5em 1.5em;
	background: #ddd;
	color: var(--shade2);
	text-align: right
}
            
          
!
            
              const _HUE = document.getElementById('hue');

function update() {
    document.body.style.setProperty('--hue', +_HUE.value);
};

_HUE.addEventListener('input', update, false);
_HUE.addEventListener('change', update, false);
            
          
!
999px
Loading ..................

Console