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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console