Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!-- 
For CSS Grid expertise:
Rachel Andrew: https://gridbyexample.com/
Jen Simmons: http://labs.jensimmons.com/
 -->
<div id="holder">
  <div id="grid2-1" class="grid2">
    <div id="wall2-1" class="wall"></div>
    <div id="window2-1" class="window"></div>
  </div>
  <div id="grid2-2" class="grid2">
    <div id="wall2-2" class="wall"></div>
    <div id="foundation2-1" class="foundation"></div>
    <div id="window2-2" class="window"></div>
    <div id="door2-1" class="door"></div>
  </div>
  <div id="grid2-3" class="grid2">
    <div id="wall2-3" class="wall"></div>
    <div id="wall2-4" class="wall"></div>
    <div id="foundation2-2" class="foundation"></div>
    <div id="window2-3" class="window"></div>
    <div id="floorlight2-1" class="floorlight"></div>
    <div id="floorlight2-2" class="floorlight"></div>
  </div>
  <div id="grid1-1" class="grid1">
    <div id="wall1-1" class="wall"></div>
    <div id="wall1-2" class="wall"></div>
    <div id="wall1-3" class="wall"></div>
    <div id="foundation1-1" class="foundation"></div>
    <div id="window1-1" class="window"></div>
    <div id="window1-2" class="window"></div>
    <div id="window1-3" class="window"></div>
    <div id="floorlight1-1" class="floorlight"></div>
    <div id="door1-1" class="door"></div>
  </div>
  <div id="grid1-2" class="grid1">
    <div id="wall1-4" class="wall"></div>
  </div>
  <div id="grid2-4" class="grid2">
    <div id="wall2-5" class="wall"></div>
  </div>
  <div id="grid3-1" class="grid3">
    <div id="wall3-1" class="wall"></div>
  </div>
  <div id="grid2-5" class="grid2">
    <div><h1>Bau-house</h1><p>An experiment in <br>
      3D transformations<br> and CSS Grid.</p></div>
  </div>
</div>
<div id="description">
  <p>Whilst I was playing around with CSS Grids and 3D transformations I thought I'd have a go at making <a target="_blank" href="http://www.bauhaus-dessau.de/en/architecture/bauhaus-buildings-in-dessau/new-masters-houses.html">this house</a>.</p>
  <p>Is there any practical use for this? I'm unconvinced.</p>
  <p>Photos of actual house:</p>
</div>
<div id="photos">
  <div><img src="https://andybarefoot.com/codepen/bauhaus/bauhaus3.jpg"></div>
  <div><img src="https://andybarefoot.com/codepen/bauhaus/bauhaus1.jpg"></div>
  <div><img src="https://andybarefoot.com/codepen/bauhaus/bauhaus2.jpg"></div>
</div>
              
            
!

CSS

              
                /* Grid 1: 158fr:72fr */
/* Grid 2: 167fr:72fr */

h1 {
  font-family: 'Baumans', cursive;
  font-size: 4vw;
  margin-left: -10vw;
  margin-top: 10vw;
}
p{
  font-family: 'Ubuntu', sans-serif;
  font-size: 1.5vw;
  margin-left: -10vw;
}
#description > p{
  font-size: 1em;
  margin: 1em 10vw 0 10vw;
}

body{
  background-color: #65A598;
  width: 100vw;
  perspective: 1000px;
  perspective-origin: 50vw 32.5vw;
  animation-name: perspectivechange;
  animation-duration: 4s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: ease;
}
@-moz-document url-prefix() {
    body {
        animation: none !important;
    }
}

body, a{
  color: #031926;
}
#holder{
  background-color: #6E9EAF;
  width: 100vw;
  height: 35.5vw; /*  */
}
#description{
  margin-top: 25vw;
  width: 100vw;
}
#photos{
  margin: 1em 10vw 4em 10vw;
  display: grid;
  grid-template-columns:repeat(auto-fill, minmax(300px,1fr));
  grid-gap: 20px;
}
#photos > div > img{
  width: 100%;
}
.grid1{
  position: absolute;
  right: 70vw;
  top: 10vw;
  transform-origin: 100% 50%;
  width: 94.61vw;
  height: 43.11vw;
  display: grid;
  grid-template-columns: 18fr 14fr 19fr 14fr 13fr 2fr 9fr 23fr 8fr 38fr;
  grid-template-rows: 7fr 14fr 12fr 17fr 7fr 3fr 4fr 6fr 2fr;  
}
#grid1-1{
  transform: rotateY(-45deg) translatez(-9.03vw);
}
#grid1-2{
  transform: rotateY(-45deg);
}
.grid2{
  position: absolute;
  left: 30vw;
  top: 10vw;
  transform-origin: 0% 50%;
  width: 100vw;
  height: 43.11vw;
  background-color: rgba(0,0,0,0);
  display: grid;
  grid-template-columns: 15fr 19fr 10fr 5fr 7fr 9fr 13fr 4fr 5fr 1fr 14fr 10fr 3fr 18fr 5fr 29fr;
  grid-template-rows: 7fr 14fr 3fr 5fr 4fr 3fr 14fr 7fr 3fr 4fr 6fr 2fr;  
}
#grid2-1{
  transform: rotateY(45deg) translatez(-57vw);
}
#grid2-2{
  transform: rotateY(45deg) translatez(-22.75vw);
}
#grid2-3{
  transform: rotateY(45deg) translatez(-0.1vw);
}
#grid2-4{
  transform: rotateY(45deg) translatez(-55.69vw);
}
#grid2-5{
  transform: rotateY(45deg);
}


.grid3{
  position: absolute;
  left: 30vw;
  top: 10vw;
  transform-origin: 0% 100%;
  width: 94.61vw;
  height: 8.98vw;
  background-color: rgba(0,0,0,0);
  display: grid;
  grid-template-columns: 93fr 65fr;
  grid-template-rows: 1fr;  
}
#grid3-1{
  transform: rotateY(135deg) rotateX(270deg) translatez(25.15vw);
}


.grid2 > .wall {
  background-color: #cccccc;
  border: 2px solid #bdbdbd;
}
.grid1 > .wall {
  background-color: #bdbdbd;
}
.grid2 > .window{
  background-color: #264057;
  border: 3px solid black;
}
.grid1 > .window{
  background-color: #17324a;
  border: 3px solid black;
}
.grid2 > .door{
  background-color: #d4d4d4;
  border: 3px solid #81827d;
}
.grid1 > .door{
  background-color: #c4c4c4;
  border: 3px solid #81827d;
}
.grid2 > .foundation{
  background-color: #d9d5d2;
  border: 1px solid #c9c6c3;
}
.grid1 > .foundation{
  background-color: #c9c6c3;
}
.grid2 > .floorlight{
  background-color: #264057;
  border: 3px solid #6b6b6a;
}
.grid1 > .floorlight{
  background-color: #17324a;
  border: 3px solid #3b3b3b;
}
#wall1-1{
  grid-column: 1 / -1;
  grid-row: 1 / 4;
}
#wall1-2{
  grid-column: 1 / -2;
  grid-row: 4;
}
#wall1-3{
  grid-column: 1 / -1;
  grid-row: 5 / 7;
}
#window1-1{
  grid-column: 2;
  grid-row: 2;
}
#window1-2{
  grid-column: 4;
  grid-row: 2;
}
#window1-3{
  grid-column: 6 / 9;
  grid-row: 4;
}
#floorlight1-1{
  grid-column: 7;
  grid-row: 8;
}
#door1-1{
  grid-column: 4;
  grid-row: 4 / 6;
}
#foundation1-1{
  grid-column: 1 / -1;
  grid-row: 7 / -1;
}
#wall1-4{
  grid-column: 1 / 5;
  grid-row: 6 / -1;
}

#wall2-1 {
  grid-column: 7 / -3;
  grid-row: 1 / 5;
}

#window2-1 {
  grid-column: 10 / 14;
  grid-row: 2 / 4;
}

#wall2-2 {
  grid-column: 2 / -1;
  grid-row: 5 / -4;
}

#foundation2-1 {
  grid-column: -2 / -1;
  grid-row: -4 / -1;
}

#window2-2 {
  grid-column: 9 / 13;
  grid-row: 7 / 9;
}

#door2-1 {
  grid-column: 3;
  grid-row: 7 / 10;
}

#wall2-3 {
  grid-column: 2 / 7;
  grid-row: 1 / 6;
}

#wall2-4 {
  grid-column: 2 / -2;
  grid-row: 8 / 10;
}

#foundation2-2 {
  grid-column: 2 / -2;
  grid-row: 10 / -1;
  border: 1px solid #b3b3b3;
  border-top: none;
}

#window2-3 {
  grid-column: 5;
  grid-row: 2;
}

#floorlight2-1 {
  grid-column: 8 / 11;
  grid-row: 11;
}

#floorlight2-2 {
  grid-column: 12;
  grid-row: 11;
}

#wall2-5 {
  grid-column: 1;
  grid-row: 9 / -1;
}
#wall3-1{
  grid-column: 2;
  grid-row: 1;
  background-color: #d9d9d9;
}

@keyframes perspectivechange {
    0% {perspective-origin: 40% 30vw;}
    100% {perspective-origin: 160% 30vw;}
}

@media (min-width: 750px) {
  @keyframes perspectivechange {
    0% {perspective-origin: 45% 30vw;}
    100% {perspective-origin: 140% 30vw;}
  }
}

@media (min-width: 1000px) {
  @keyframes perspectivechange {
    0% {perspective-origin: 45% 30vw;}
    100% {perspective-origin: 120% 30vw;}
  }
}

@media (min-width: 1250px) {
  @keyframes perspectivechange {
    0% {perspective-origin: 45% 30vw;}
    100% {perspective-origin: 100% 30vw;}
  }
}

@media (min-width: 1500px) {
  @keyframes perspectivechange {
    0% {perspective-origin: 45% 30vw;}
    100% {perspective-origin: 90% 30vw;}
  }
}

@media (min-width: 2000px) {
  @keyframes perspectivechange {
    0% {perspective-origin: 45% 30vw;}
    100% {perspective-origin: 80% 30vw;}
  }
}



              
            
!

JS

              
                
              
            
!
999px

Console