Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <div class="container">

  <div class="ground">
    <div class="ground_top"></div>
    <div class="ground_left"></div>
    <div class="ground_front"></div>
  </div>

  <div class="building">
    <div class="roof top"></div>
    <div class="roof front"></div>
    <div class="roof left"></div>

    <div class="chimney top"></div>
    <div class="chimney front"></div>
    <div class="chimney left"></div>
    <div class="chimney-b front"></div>
    <div class="chimney-b left"></div>

    <div class="building-a top"></div>
    <div class="building-a front windowed"></div>
    <div class="building-a left windowed"></div>

    <div class="building-b top"></div>
    <div class="building-b front"></div>
    <div class="building-b left windowed"></div>

    <div class="building-c top"></div>
    <div class="building-c front"></div>
    <div class="building-c left"></div>

    <div class="colunm-a front"></div>
    <div class="colunm-a left"></div>
    <div class="colunm-b front"></div>
    <div class="colunm-b left"></div>

    <div class="door windowed"></div>

  </div>

</div>

<a href="https://twitter.com/amit_sheen" class="twitterLink" target="_blank">
   <img src="https://assets.codepen.io/1948355/twitterLogo2.png" />
</a>

              
            
!

CSS

              
                *, *::before, *::after {
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
}

body {
    text-align: center;
    background-color: #aaa;
    color: #246;
    display: grid;
    place-items: center;
    min-height: 100vh;
}

:root {
    --clr-green: #388E3C;
    --clr-brown: #3E2723;
    --clr-white: #4446;
    --clr-glass: #81D4FA;
}

.container {
    position: relative;
    width: 420px; height: 420px;
    border: 1px #fff solid;
    border-radius: 4px;
    perspective: 1420px;
    perspective-origin: 0% -25%;
    transform-style: preserve-3d;
}

.ground {

    &_top {
        position: absolute;
        top: 380px; left: 50%;
        background-color: var(--clr-green);
        width: 280px; height: 280px;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg);
    }

    &_front {
        position: absolute;
        top: 380px; left: 50%;
        background-image: linear-gradient(var(--clr-green) 20%, var(--clr-brown) 80%);
        width: 280px; height: 20px;
        transform: translateX(-50%) rotateY(-45deg) translateZ(140px);
    }

    &_left {
        position: absolute;
        top: 380px; left: 50%;
        background-image: linear-gradient(var(--clr-green) 20%, var(--clr-brown) 80%);
        width: 280px; height: 20px;
        transform: translateX(-50%) rotateY(45deg) translateZ(140px);
    }
}


.building {
    
    & > * {
        position: absolute;
        left: 50%;
        border: 0.5px solid var(--clr-white);
        transform-origin: left top;
        transform-style: preserve-3d;
        
        &.windowed::before {
            content: '';
            position: absolute;
            top: 0; left: 0; bottom: 0; right: 0;
            background-color: var(--clr-glass);
            transform: translateZ(-0.1px);
        }
    }
    
    & .top { --clr-wall: #D32F2F; }
    & .front { --clr-wall: #B71C1C; }
    & .left { --clr-wall: #C62828; }
    
    &-b, &-c, & .roof {
        &.top { --clr-wall: #E64A19; }
        &.front { --clr-wall: #BF360C; }
        &.left { --clr-wall: #D84315; }
    }

    & .roof.top {
        top: 125px;
        width: 60px; height: 80px;
        background-color: var(--clr-wall);
        transform-origin: center;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg) translateX(-40px);
    }

    & .roof.front {
        top: 125px;
        background-color: var(--clr-wall);
        width: 60px; height: 15px;
        transform: rotateY(-45deg) translateX(-70px) translateZ(40px);
    }

    & .roof.left {
        top: 125px;
        background-color: var(--clr-wall);
        width: 80px; height: 15px;
        transform: rotateY(45deg) translateX(-40px) translateZ(-10px);
    }

    & .chimney.top {
        top: 100px;
        width: 30px; height: 30px;
        background-image:
            linear-gradient(
                var(--clr-wall) 5px, transparent 5px, transparent 25px, var(--clr-wall) 25px),
            linear-gradient(90deg,
                var(--clr-wall) 5px, transparent 5px, transparent 25px, var(--clr-wall) 25px);

        transform-origin: center;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg) translateY(-35px) translateX(45px);
    }

    & .chimney.front {
        top: 100px;
        background-color: var(--clr-wall);
        width: 30px; height: 40px;
        transform: rotateY(-45deg) translateX(30px) translateZ(-20px);
    }

    & .chimney.left {
        top: 100px;
        background-color: var(--clr-wall);
        width: 30px; height: 40px;
        transform: rotateY(45deg) translateX(20px) translateZ(60px);
    }

    & .chimney-b.front {
        top: 100px;
        background-color: var(--clr-wall);
        width: 20px; height: 40px;
        transform: rotateY(-45deg) translateX(35px) translateZ(-45px);
    }

    & .chimney-b.left {
        top: 100px;
        background-color: var(--clr-wall);
        width: 20px; height: 40px;
        transform: rotateY(45deg) translateX(25px) translateZ(35px);
    }

    &-a.top {
        top: 140px;
        background-color: var(--clr-wall);
        width: 160px; height: 120px;
        transform-origin: center;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg) translateX(-10px);
    }

    &-a.front {
        top: 140px;
        background-image:
            linear-gradient(
                var(--clr-wall) 30px, transparent 30px, transparent 60px, var(--clr-wall) 60px,
                var(--clr-wall) 100px, transparent 100px, transparent 130px, var(--clr-wall) 130px),
            linear-gradient(90deg,
                var(--clr-wall) 20px, transparent 20px, transparent 70px, var(--clr-wall) 70px,
                var(--clr-wall) 90px, transparent 90px, transparent 140px, var(--clr-wall) 140px);
        width: 160px; height: 240px;
        transform: rotateY(-45deg) translateX(-90px) translateZ(60px);

        &::before {
            background-image:
                linear-gradient(
                    var(--clr-white) 30px, transparent 32px, transparent 44px, var(--clr-white) 44px,
                    var(--clr-white) 46px, transparent 46px, transparent 58px, var(--clr-white) 60px,
                    var(--clr-white) 100px, transparent 102px, transparent 114px, var(--clr-white) 114px,
                    var(--clr-white) 116px, transparent 116px, transparent 128px, var(--clr-white) 130px),
                linear-gradient(90deg,
                    var(--clr-white) 20px, transparent 22px, transparent 35px, var(--clr-white) 35px,
                    var(--clr-white) 37px, transparent 37px, transparent 52px, var(--clr-white) 52px,
                    var(--clr-white) 54px, transparent 54px, transparent 68px, var(--clr-white) 70px,
                    var(--clr-white) 90px, transparent 92px, transparent 105px, var(--clr-white) 105px,
                    var(--clr-white) 107px, transparent 107px, transparent 122px, var(--clr-white) 122px,
                    var(--clr-white) 124px, transparent 124px, transparent 138px, var(--clr-white) 140px);
        }
    }

    &-a.left {
        top: 140px;
        background-image:
            linear-gradient(
                var(--clr-wall) 30px, transparent 30px, transparent 60px, var(--clr-wall) 60px),
            linear-gradient(90deg,
                var(--clr-wall) 20px, transparent 20px, transparent 50px, var(--clr-wall) 50px,
                var(--clr-wall) 70px, transparent 70px, transparent 100px, var(--clr-wall) 100px);
        width: 120px; height: 240px;
        transform: rotateY(45deg) translateX(-60px) translateZ(70px);

        &::before {
            background-image:
                linear-gradient(
                    var(--clr-white) 30px, transparent 32px, transparent 44px, var(--clr-white) 44px,
                    var(--clr-white) 46px, transparent 46px, transparent 58px, var(--clr-white) 60px),
                linear-gradient(90deg,
                var(--clr-white) 20px, transparent 22px, transparent 34px, var(--clr-white) 34px,
                var(--clr-white) 36px, transparent 36px, transparent 48px, var(--clr-white) 50px,
                var(--clr-white) 70px, transparent 72px, transparent 84px, var(--clr-white) 84px,
                var(--clr-white) 86px, transparent 86px, transparent 98px, var(--clr-white) 100px);
        }
    }

    &-b.top {
        top: 220px;
        background-color: var(--clr-wall);
        width: 40px; height: 80px;
        transform-origin: center;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg) translateX(90px);
    }

    &-b.front {
        top: 220px;
        background-color: var(--clr-wall);
        width: 40px; height: 160px;
        transform: rotateY(-45deg) translateX(70px) translateZ(40px);
    }

    &-b.left {
        top: 220px;
        width: 80px; height: 160px;
        background-image:
            linear-gradient(
                var(--clr-wall) 30px, transparent 30px, transparent 60px, var(--clr-wall) 60px,
                var(--clr-wall) 80px, transparent 80px, transparent 130px, var(--clr-wall) 130px
                ),
            linear-gradient(90deg,
                var(--clr-wall) 20px, transparent 20px, transparent 60px, var(--clr-wall) 60px);
        transform: rotateY(45deg) translateX(-40px) translateZ(110px);

        &::before {
            background-image:
                linear-gradient(
                    var(--clr-white) 30px, transparent 32px, transparent 44px, var(--clr-white) 44px,
                    var(--clr-white) 46px, transparent 46px, transparent 58px, var(--clr-white) 60px,
                    var(--clr-white) 80px, transparent 82px, transparent 104px, var(--clr-white) 104px,
                    var(--clr-white) 106px, transparent 106px, transparent 128px, var(--clr-white) 130px,
                    ),
                linear-gradient(90deg,
                    var(--clr-white) 20px, transparent 22px, transparent 39px, var(--clr-white) 39px,
                    var(--clr-white) 41px, transparent 41px, transparent 58px, var(--clr-white) 60px);
        }
    }

    & .building-c.top {
        top: 290px;
        width: 110px; height: 20px;
        background-color: var(--clr-wall);
        transform-origin: center;
        transform: translate(-50%, -50%) rotateX(90deg) rotate(45deg) translateX(-10px) translateY(70px);
    }

    & .building-c.front {
        top: 290px;
        background-color: var(--clr-wall);
        width: 110px; height: 10px;
        transform: rotateY(-45deg) translateX(-65px) translateZ(80px);
    }

    & .building-c.left {
        top: 290px;
        background-color: var(--clr-wall);
        width: 20px; height: 10px;
        transform: rotateY(45deg) translateX(-40px) translateZ(45px) translateX(-40px);
    }

    & .colunm-a.front {
        top: 300px;
        background-color: var(--clr-wall);
        width: 10px; height: 80px;
        transform: rotateY(-45deg) translateX(-60px) translateZ(80px);
    }

    & .colunm-a.left {
        top: 300px;
        background-color: var(--clr-wall);
        width: 20px; height: 80px;
        transform: rotateY(45deg) translateX(-40px) translateZ(-50px) translateX(-40px);
    }

    & .colunm-b.front {
        top: 300px;
        background-color: var(--clr-wall);
        width: 10px; height: 80px;
        transform: rotateY(-45deg) translateX(30px) translateZ(80px);
    }

    & .colunm-b.left {
        top: 300px;
        background-color: var(--clr-wall);
        width: 20px; height: 80px;
        transform: rotateY(45deg) translateX(-40px) translateZ(40px) translateX(-40px);
    }

    & .door {
        top: 300px;
        width: 80px; height: 80px;
        transform: rotateY(-45deg) translateX(-50px) translateZ(70px);

        &::before {
            background-image:
                linear-gradient(
                    var(--clr-white) 0px, transparent 2px, transparent 83px, var(--clr-white) 85px,
                    ),
                linear-gradient(90deg,
                    var(--clr-white) 0px, transparent 2px, transparent 39px, var(--clr-white) 39px,
                    var(--clr-white) 41px, transparent 41px, transparent 78px, var(--clr-white) 80px);
        }
    }
}

.twitterLink {
  position: fixed;
  bottom: 0.5em; right: 0.5em;
  & img {
    width: 2em;
    filter: grayscale(100%);
    transition: filter 0.25s;
    &:hover {
      filter: grayscale(0%);
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console