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.

            
              .maze
	.maze__title Binary Tree<span>Algorithm</span>
	.maze__grid
		- (1..(12*12)).each do |i|
			.maze__cell.binary-tree

.maze
	.maze__title Sidewinder<span>Algorithm</span>
	.maze__grid
		- (1..(12*12)).each do |i|
			.maze__cell.sidewinder
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Ubuntu:500)

// ---------------------- //
// Helpers & Vars         //

$cell-size: 20px
$rows: 12
$cols: 12

$border-width: 3px

$color-wall: #fffede
$color-ground: desaturate(darken(#ed8761, 25%), 30%)
$color-title: #fffede
$color-title-bg: transparent
$color-bg: linear-gradient(#ed8761 0%, darken(#ed8761, 20%) 100%)

=block($w, $h)
	display: block
	width: $w
	height: $h


// ---------------------- //
// General Page Styling   //

body
	background: $color-bg
	text-align: center
	min-height: 100vh

// ---------------------- //
// General Maze Styling   //
.maze
	+block($cell-size * $cols + $border-width, auto)
	display: inline-block
	margin: 0 20px
	position: relative
	top: 50vh
	transform: translateY(-50%)

.maze__title
	background: $color-title-bg
	color: $color-title
	text-align: center
	padding: $cell-size 0
	font-size: 1.2em
	line-height: 1.2em
	font-family: 'Ubuntu', sans-serif
	text-transform: uppercase
	letter-spacing: .35em
	font-weight: 500
	text-shadow: 3px 3px 3px $color-ground

.maze__title span 
	font-size: 0.8em
	display: inline-block
	width: 100%
	text-transform: none
	letter-spacing: .05em
	
.maze__grid
	+block($cell-size * $cols, $cell-size * $rows)
	border-top: $border-width solid $color-wall
	border-left: $border-width solid $color-wall
	outline: $border-width*1.25 solid $color-wall
	box-shadow: inset 0px 0px 100px 5px darken($color-ground, 40%)
	background: $color-ground

.maze__cell
	+block($cell-size, $cell-size)
	float: left
	box-sizing: border-box
	border-bottom: $border-width solid $color-wall
	border-right: $border-width solid $color-wall

%cell-bottomless
	border-bottom: none
%cell-rightless
	border-right: none

// ---------------------- //
// Binary Tree algorithm  //
@for $i from 1 through ($rows * $cols)
	$toss: random(2)
	$last: $i == $rows * $cols
	@if $toss == 1 and ($i % $cols !=0) or $i > ($rows * $cols) - $cols and not $last
		.binary-tree:nth-child(#{$i})
			@extend %cell-rightless
	@else if not $last
		.binary-tree:nth-child(#{$i})
			@extend %cell-bottomless

// ---------------------- //
// Side-winder algorithm  //
$group-count: 0

@for $i from 1 through ($rows * $cols)
	$toss: random(2)
	$last: $i == $rows * $cols
	@if $i > ($rows * $cols) - $cols and not $last
		.sidewinder:nth-child(#{$i})
			@extend %cell-rightless
	@else if not $last
		@if $toss == 1 and ($i % $cols !=0)
			$group-count: $group-count + 1
			.sidewinder:nth-child(#{$i})
				@extend %cell-rightless
		@else
			$break: random($group-count + 1)
			$group-count: 0
			.sidewinder:nth-child(#{$i - ($break - 1)})
				@extend %cell-bottomless
            
          
!
999px
Loading ..................

Console