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.

            
              .container
  .car
    .top
      .roof
      .window
        .shade
        .mirror
        .chairs
          .chair-left
          .chair-right
      .side-mirrors
      .hood
    .bottom
      .head-lights
        .bulbs
      .side-lights
        .bulbs
      .grill
      .bumper
  .wheels
  .underbelly
            
          
!
            
              @blue1: #D9E0E5;
@blue2: #C0CBD4;
@blue3: #92A6B5;
@blue4: #6E889D;
@blue5: #3E617D;
@blue6: #224A69;
@blue7: #1E3F58;

@border-standard: 4px solid @blue7;

body {
  background: @blue3;
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-height: 250px;
}

.car {
  animation: 2s rock infinite;
}

.top {
  position: relative;
  width: 200px;
  height: 120px;
  border: @border-standard;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  .roof {
    position: absolute;
    top: 0;
    width: 100%;
    height: 12px;
    background: @blue2;
    border-bottom: @border-standard;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: inset 0 4px 0 0 @blue1;
  }
  .window {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 184px;
    height: 52px;
    background: @blue5;
    border: @border-standard;
    border-radius: 12px;
    &:after {
      display: block;
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 110px;
      height: 40px;
      background: @blue3;
      border: @border-standard;
      border-bottom: none;
      border-top-left-radius: 12px;
      border-top-right-radius: 12px;
    }
    .shade {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 60px;
      z-index: 1;
      &:before, &:after {
        display: block;
        content: '';
        position: absolute;
        top: 0;
        width: 44px;
        height: 10px;
        background: @blue1;
        border: @border-standard;
        border-top: none;
        box-shadow: inset 0 4px 0 0 @blue2;
      }
      &:before {
        left: -44px;
        border-bottom-left-radius: 16px;
      }
      &:after {
        right: -44px;
        border-bottom-right-radius: 16px;
      }
    }
    .mirror {
      position: absolute;
      top: 16px;
      left: 50%;
      transform: translateX(-50%);
      width: 30px;
      height: 8px;
      background: @blue1;
      border: @border-standard;
      border-radius: 4px;
      z-index: 1;
      &:before {
        display: block;
        content: '';
        position: absolute;
        top: -20px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 24px;
        background: @blue7;
        border-radius: 4px;
      }
    }
    .chairs {
      display: flex;
      justify-content: space-around;
      .chair-left, .chair-right {
        position: relative;
        top: 40px;
        width: 48px;
        height: 8px;
        background: @blue6;
        border: @border-standard;
        border-bottom: none;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        z-index: 1;
        &:before {
          display: block;
          content: '';
          position: absolute;
          top: -26px;
          left: 50%;
          transform: translate(-50%);
          width: 36px;
          height: 12px;
          background: @blue6;
          border: @border-standard;
          border-radius: 4px;
          box-shadow: inset 0 4px 0 0 @blue5;
        }
      }
    }
  }
  .side-mirrors {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 238px;
    height: 16px;
    border: @border-standard;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    &:before, &:after {
      display: block;
      content: '';
      position: absolute;
      top: -26px;
      width: 20px;
      height: 30px;
      background: @blue2;
      border: @border-standard;
      border-radius: 8px;
      z-index: -1;
      box-shadow: inset 0 4px 0 0 @blue1;
    }
    &:before {
      left: -16px;
    }
    &:after {
      right: -16px;
    }
  }
  .hood {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 184px;
    height: 24px;
    border: @border-standard;
    border-bottom: none;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: inset 0 -8px 0 0 @blue4;
    &:before {
      display: block;
      content: '';
      position: absolute;
      top: 4px;
      left: 50%;
      transform: translateX(-50%);
      width: 140px;
      height: 8px;
      border: @border-standard;
      border-bottom: none;
      border-top-left-radius: 12px;
      border-top-right-radius: 12px;
    }
    &:after {
      display: block;
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100px;
      height: 8px;
      background: @blue7;
      border-top-left-radius: 52px 4px;
      border-top-right-radius: 52px 4px;
    }
  }
}

.bottom {
  position: relative;
  .head-lights {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 44px;
    background: @blue3;
    border: @border-standard;
    border-top: 0;
    &:before, &:after {
      display: block;
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);  
    }
    &:before {
      width: 132px;
      height: 30px;
      background: @blue1;
      border: @border-standard;
      border-radius: 30px;
    }
    &:after {
      width: 68px;
      height: 20px;
      background: @blue7;
      border-radius: 4px;
    }
    .bulbs {
      display: flex;
      justify-content: space-between;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 124px;
      &:before, &:after {
        display: block;
        content: '';
        width: 16px;
        height: 16px;
        background: @blue3;
        border: @border-standard;
        border-radius: 100%;
        box-shadow: inset 2px -2px 0 2px @blue2;
        z-index: 1;
      }
    }
  }
  .side-lights {
    position: absolute;
    bottom: -34px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 24px;
    background: @blue3;
    border: @border-standard;
    border-radius: 8px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: -1;
    .bulbs {
      position: absolute;
      top: -6px;
      left: 50%;
      transform: translateX(-50%);
      width: 228px;
      display: flex;
      justify-content: space-between;
      background: @blue3;
      &:before, &:after {
        display: block;
        content: '';
        width: 25px;
        height: 15px;
        margin: -4px -4px 0;
        border: @border-standard;
        border-radius: 4px;
        background: linear-gradient(to bottom, @blue1 0%, @blue1 24%, @blue7 25%, @blue7 55%, @blue4 56%, @blue4 100%);
      }
    }
  }
  .grill {
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 10px;
    border-top: 14px solid @blue3;
    border-left: 10px solid @blue7;
    border-right: 10px solid @blue7;
    &:before, &:after {
      display: block;
      content: '';
      position: absolute;
      top: -10px;
      left: 12px;
      width: 40px;
      height: 6px;
      background: @blue7;
      border-radius: 4px;
    }
    &:after {
      left: auto;
      right: 12px;
    }
  }
  .bumper {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 24px;
    background: @blue2;
    border-top: 6px solid @blue1;
    border-bottom: 6px solid @blue3;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    &:before, &:after {
      display: block;
      content: '';
      width: 8px;
      height: 8px;
      background: @blue7;
      border-radius: 50%;
      margin: 0 30px;
    }
  }
}

.underbelly {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  height: 80px;
  background: @blue7;
  z-index: -5;
  &:after {
    display: block;
    content: '';
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: @blue7;
    border-radius: 50%;
  }
}

.wheels {
  position: absolute;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% + 20px);
  display: flex;
  justify-content: space-between;
  z-index: -1;
  &:before, &:after { 
    display: block;
    content: '';
    width: 42px;
    height: 100px;
    background: @blue7;
    border: @border-standard;
    border-radius: 15px;
    box-shadow: inset 0 10px 0 0 @blue5;
    animation: .5s bump2 infinite;
  }
  &:after {
    animation: .5s bump infinite;
  }
}

@keyframes rock {
  0% {
    transform: rotate(.5deg);
  }
  50% {
    transform: rotate(-.5deg);
  }
  100% {
    transform: rotate(.5deg);
  }
}

@keyframes bump {
  0% {
    transform: translateY(2px);
  }
  50% {
    transform: translateY(0px);
  }
  100% {
    transform: translateY(2px);
  }
}

@keyframes bump2 {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(2px);
  }
  100% {
    transform: translateY(0px);
  }
}
            
          
!
999px
Loading ..................

Console