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.

            
              <main>
		<header>
			<h1>CSS GRIDS <span>x</span> PIET MONDRIAN</h1>
			<p>Reproductions of artwork by Piet Mondrian (1872 - 1944) using CSS Grids</p>
		</header>
		<section class="section--one">
				<div class="painting--one__main">
					<div class="item red"></div>
					<div class="item"></div>
					<div class="item"></div>
					<div class="item inner-grid">
						<div class="inner-item"></div>
						<div class="inner-item"></div>
					</div>
					<div class="item"></div>
					<div class="item"></div>
					<div class="item"></div>
					<div class="item"></div>
					<div class="item"></div>
				</div>
			<p>Composition B (No.II) with Red | 1935</p>
		</section>
		<section class="section--two">
				<div class="painting--two__main">
					<div class="item"></div>
					<div class="item"></div>
					<div class="item inner-grid-2">
						<div class="inner-item blue"></div>
						<div class="inner-item"></div>
						<div class="inner-item"></div>
					</div>
				</div>
			<p>Vertical Composition with Blue and White | 1936</p>
		</section>
		<section class="section--three">
				<div class="painting--three__main">
					<div class="item red"></div>
					<div class="item"></div>
					<div class="item"></div>
					<div class="item inner-grid-1">
						<div class="inner-grid-2">
							<div class="inner-item"></div>
							<div class="inner-grid-3">
								<div class="inner-item yellow"></div>
								<div class="inner-item black"></div>
							</div>
						</div>
						<div class="inner-grid-4">
							<div class="inner-item blue"></div>
							<div class="inner-item"></div>
						</div>
					</div>
				</div>
			<p>Composition | 1929</p>
		</section>
	</main>
            
          
!
            
              article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:700;}dfn{font-style:italic;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace, serif;font-size:1em;}pre{white-space:pre-wrap;word-wrap:break-word;}q{quotes:\201C \201D \2018 \2019;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-.5em;}sub{bottom:-.25em;}img{border:0;}svg:not(:root){overflow:hidden;}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,html input[type=button],/* 1 */
input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;}button[disabled],input[disabled]{cursor:default;}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;}body,figure{margin:0;}legend,button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}

.clearfix:after {visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }

* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

$black : #333;
$blackOil : #181A19;
$white : #FFF;
$redOil : #A11E02;
$yellowOil: #D1BE37;
$grey : #DEDEDE;
$blueOil : #2E398B;
$canvas : #EEE;

$font-family : "Roboto Mono", monospace;

body {
	font-family:$font-family;
	font-size:14px;
	background: $grey;
}

main {
	max-width:900px;
	margin:0 auto;
	background:$white;
	box-shadow:0 0 2px $canvas;
}

header {
	text-align:center;
	padding:40px 40px 0 40px;

	h1 {
		margin-top: 0;

		span {
			position: relative;
			top:-2px;

		}
	}
}

section {
	padding:40px;
	text-align:center;
}

//painting 1

.painting--one__main {
	width:300px;
	height:380px;
	position:relative;
	margin:0 auto 40px auto;
	background:$blackOil;
	display:grid;
	grid-template-columns: 130px 62px 92px;
  grid-template-rows: 115px 124px 121px;
  grid-column-gap: 8px;
  grid-row-gap: 10px;
  box-shadow:0px 4px 6px $grey;
  overflow:hidden;

  .item {
  	background:$canvas;
  }

  .red {
  	background:$redOil;
  }

  .inner-grid {
  	display:grid;
  	grid-template-columns: 8px 117px;
  	grid-column-gap: 5px;
  	background: $blackOil;
  }

  .inner-item {
  	background:$canvas;
  }
}

//painting 2

.painting--two__main {
	width:245px;
	height:500px;
	position:relative;
	margin:0 auto 40px auto;
	background:$blackOil;
	display:grid;
	grid-template-columns: 30px 109px 95px;
  grid-column-gap: 8px;
  box-shadow:0px 4px 6px $grey;
  overflow:hidden;

  .item {
  	background:$canvas;
  }

  .inner-grid-2 {
  	display:grid;
  	grid-template-rows: 42px 338px 104px;
  	grid-row-gap: 8px;
  	background: $blackOil;
  }

  .inner-item {
  	background:$canvas;
  }

  .blue {
  	background:$blueOil;
  }
}

//painting 3

.painting--three__main {
	width:300px;
	height:300px;
	position:relative;
	margin:0 auto 40px auto;
	background:$blackOil;
	display:grid;
	grid-template-columns: 84px 208px;
  grid-column-gap: 8px;
  grid-template-rows: 90px 202px;
  grid-row-gap: 8px;
  box-shadow:0px 4px 6px $grey;
  overflow:hidden;

  .item {
  	background:$canvas;
  }

  .inner-grid-1 {
  	display:grid;
  	grid-template-columns: 185px 15px;
  	grid-column-gap: 8px;
  	background: $blackOil;
  }

  .inner-grid-2 {
  	display:grid;
  	grid-template-rows: 184px 10px;
  	grid-row-gap: 8px;
  	background: $blackOil;
  }

  .inner-grid-3 {
  	display:grid;
  	grid-template-columns: 118px 58px;
  	grid-column-gap: 8px;
  	background: $blackOil;
  }

  .inner-grid-4 {
  	display:grid;
  	grid-template-rows: 74px 120px;
  	grid-row-gap: 8px;
  	background: $blackOil;
  }

 	.inner-item {
 		background: $canvas;
 	}

 	.red {
 		background:$redOil;
 	}

 	.blue {
 		background: $blueOil;
 	}

 	.yellow {
 		background: $yellowOil;
 	}
 	.black {
 		background: $blackOil;
 	}
}





            
          
!
            
              //Just for fun...starting to learn CSS by recreating the work of Piet Mondrian
            
          
!
999px
Loading ..................

Console