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

Packages

Add Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              - const randomInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min
.title
  - for (const [index, letter] of 'CYBRTRK'.split('').entries())
    span(data-char=letter, style=`--index: ${index}`)= letter
.backdrop
  - let m = 0
  while m < 10
    .mountain(style=`--lightness: ${randomInRange(2, 10)}; --height: ${randomInRange(10, 45)}; --width: ${randomInRange(10, 40)}; --speed: ${randomInRange(10, 50)}; --distance: ${randomInRange(150, 200)}; --delay: ${randomInRange(10, 50)}`)
    - m++
.truck
  .truck__body
    .truck__body.truck__body--top
      .truck__window
        .truck__window-glass
    .truck__body.truck__body--mid
      .truck__mid-body
    .truck__body.truck__body--bottom
      .truck__underpanel
      .truck__rear-bumper
      .truck__side-skirt
  .truck__wheel.truck__wheel--front
    .truck__wheel-arch
    .truck__wheel-arch-trim.truck__wheel-arch-trim--top
    .truck__wheel-arch-trim.truck__wheel-arch-trim--left
    .truck__wheel-arch-trim.truck__wheel-arch-trim--right
    .truck-wheel
      .truck-wheel__rim
        - let s = 0
        while s < 7
          .truck-wheel__spoke(style=`--index: ${s};`)
          - s++
  .truck__wheel.truck__wheel--rear
    .truck__wheel-arch
    .truck__wheel-arch-trim.truck__wheel-arch-trim--top
    .truck__wheel-arch-trim.truck__wheel-arch-trim--left
    .truck__wheel-arch-trim.truck__wheel-arch-trim--right
    .truck-wheel
      .truck-wheel__rim
        - let r = 0
        while r < 7
          .truck-wheel__spoke(style=`--index: ${r};`)
          - r++
  .truck__headlight
  .truck__taillight
  .truck__indicator
  .truck__foglight
            
          
!
            
              *
  box-sizing border-box

.truck *
  transition all .25s ease

body
  align-items center
  background linear-gradient(180deg, hsl(225, 15%, 12%), hsl(225, 15%, 8%) 50%, hsl(25, 0%, 10%) 50%), hsl(25, 0%, 10%)
  display flex
  justify-content center
  min-height 100vh
  overflow hidden
  width 100vw

:root
  --width 300

  @media(min-width 768px)
    --width 600

.title
  display none
  --color hsl(0, 0%, 70%)
  --speed .1
  text-transform uppercase
  color var(--color)
  text-shadow 0 0 20px var(--color)
  font-size 25vh
  font-family 'Wallpoet', cursive
  position absolute
  bottom 42%
  left 50%
  transform translate(-50%, 0)

  span
    animation flicker calc(var(--speed, 4) * 1s) calc(var(--delay, 0) * 1s) infinite steps(1)
    opacity var(--opacity, 1)
    --speed calc(var(--index) + 1)
    --delay var(--index)

  @keyframes flicker
    0%
    20%
      --opacity 0.25
    10%
    30%
    40%
    70%
    80%
    90%
    100%
      --opacity 1

.mountain
  height calc(var(--height) * 1vh)
  width calc(var(--width) * 1vw)
  position absolute
  bottom 50%
  background 'hsl(35, 0%, %s)' % calc(var(--lightness) * 1%)
  left 50%
  animation backdrop calc(var(--speed) * 1s) calc(var(--delay) * -1s) infinite linear both

@keyframes backdrop
  from
    transform translate(calc(var(--distance) * 1vw), 0)
  to
    transform translate(calc(var(--distance) * -1vw), 0)

.truck
  position relative
  width calc(var(--width) * 1px)
  height calc(var(--width) * .33px)

  &:after
    content ''
    height 5%
    width 100%
    background hsl(0, 0%, 0%)
    position absolute
    left 0
    bottom 5%
    border-radius 100%
    filter blur(10px)

  &__indicator
    height 2%
    width 3%
    position absolute
    right 1.5%
    background hsl(37, 90%, 30%)
    top 64%
    opacity .45
    z-index 10

  &__foglight
    height 2%
    width 1%
    position absolute
    left 2%
    background hsl(5, 90%, 30%)
    top 58%
    opacity .45
    z-index 10

  &__taillight
    height 2%
    width 1%
    background radial-gradient(circle at center, hsl(0, 100%, 96%), hsl(0, 100%, 50%)), red
    box-shadow 0 0 30px 5px hsl(0, 100%, 60%)
    position absolute
    top 25%
    z-index 10
    left 0
    &:after
      content ''
      height 100%
      width 800%
      background hsl(0, 100%, 65%)
      position absolute
      right 0
      top 0
      border-radius 25%
      filter blur(8px)
      box-shadow 0 0 60px 5px hsl(0, 100%, 75%)

  &__headlight
    height 5%
    width 4%
    position absolute
    right 0
    border-radius 25%
    top 42%
    z-index 10
    transform rotate(4deg)
    background white
    box-shadow 0 0 40px 5px hsl(220, 100%, 80%),
      0 0 2px 2px hsl(220, 100%, 85%) inset
    &:after
      content ''
      position absolute
      top 20%
      left 0
      height 60%
      width 100vw
      background linear-gradient(0deg, hsl(220, 100%, 80%), hsl(220, 90%, 90%), hsl(220, 100%, 80%)), hsl(220, 100%, 90%)
      filter blur(6px)
      box-shadow 0 0 20px 5px hsl(220, 100%, 80%),
        0 0 80px 2px hsl(220, 100%, 80%)

  &__wheel
    position absolute

    &--front
      height 57%
      width 21%
      // background red
      bottom 0
      left 75%
      z-index 4
      transform rotate(2deg)

    &--rear
      height 57%
      width 21%
      bottom 2%
      left 10%
      z-index 4
      transform rotate(2deg)

  &-wheel
    border-radius 100%
    height calc(var(--width) * .15px)
    width calc(var(--width) * .15px)
    background hsl(0, 0%, 14%)
    border-top 1px solid hsl(0, 0%, 80%)
    position absolute
    bottom 0
    left 52%
    transform translate(-50%, 0)

    &__rim
      height 60%
      width 60%
      background radial-gradient(circle at center, transparent, hsl(0, 0%, 40%)), hsl(0, 0%, 5%)
      position absolute
      top 50%
      left 50%
      transform translate(-50%, -50%)
      border-radius 100%
      animation spin .35s infinite linear

      @keyframes spin
        to
          transform translate(-50%, -50%) rotate(360deg)

      &:after
        content ''
        height 35%
        width 35%
        background radial-gradient(circle at center, hsl(0, 0, 5%), hsl(0, 0, 5%) 40%, transparent 40%),
          radial-gradient(circle at center, hsl(0, 0%, 15%), hsl(0, 0%, 15%) 40%, transparent), hsl(0, 0%, 55%)
        border 1px solid hsl(0, 0%, 10%)
        position absolute
        top 50%
        left 50%
        transform translate(-50%, -50%)
        border-radius 100%
        z-index 2

    &__spoke
      position absolute
      height 60%
      width 20%
      background linear-gradient(0deg, transparent, hsl(0, 0%, 10%) 50%), hsl(0, 0%, 50%)
      border-left 1px solid hsl(0, 0%, 30%)
      border-right 1px solid hsl(0, 0%, 20%)
      border-radius 0 0 25% 25%
      top 50%
      left 50%
      transform-origin top center
      transform translate(-50%, 0) rotate(calc(360 / 7 * var(--index) * 1deg))


  &__wheel-arch
    background hsl(0, 0%, 3%)
    position absolute
    top 0
    left 0
    right 1%
    height 54%
    $clip = polygon(0 100%, 23% 0, 81% 0%, 95% 60%, 95% 100%)
    -webkit-clip-path $clip
    clip-path $clip

  &__wheel-arch-trim
    position absolute
    &--top
      top 0
      left 25%
      background hsl(0, 0%, 55%)
      height 5%
      width 53%
      z-index 2
    &--left
      top 0
      left -20%
      background linear-gradient(160deg, transparent, hsl(0, 0%, 40%)),  hsl(0, 0%, 20%)
      height 5%
      width 44%
      transform-origin top right
      transform rotate(-60deg)
    &--right
      top 0
      left 79%
      background linear-gradient(-158deg, transparent, hsl(0, 0%, 40%)),  hsl(0, 0%, 20%)
      height 5%
      width 35%
      transform-origin top left
      transform rotate(58deg)

  &__body
    position absolute
    height 100%
    width 100%

    &--top
      background linear-gradient(90deg, hsl(0, 10%, 95%), hsl(0, 0%, 75%) 50%), hsl(0, 10%, 90%)
      height 33%
      width 100%
      top 0
      transform rotate(3deg)
      $clip = polygon(0 100%, 58% 0, 98% 100%)
      -webkit-clip-path $clip
      clip-path $clip

      &:before
        --groove hsl(0, 0%, 60%)
        content ''
        background linear-gradient(95deg, transparent, transparent 2%, var(--groove) 2%, var(--groove) 3%, transparent 3%),
          linear-gradient(75deg, transparent, transparent 47%, var(--groove) 47%, var(--groove) 48%, transparent 48%),
          linear-gradient(78deg, transparent, transparent 95%, var(--groove) 95%, var(--groove) 96%, transparent 96%)
        position absolute
        height 55%
        width 40%
        left 36%
        bottom 0
        $clip = polygon(0 100%, 0 0, 100% 58%, 100% 100%)
        -webkit-clip-path $clip
        clip-path $clip

    &--mid
      position absolute
      width 100%
      height 36%
      top 25%
      transform rotate(3deg)
      transform-origin top left
      z-index 2

      // front bumper
      &:after
        content ''
        position absolute
        background hsl(0, 0%, 12%)
        height 20%
        width 5%
        bottom 20%
        right -0.25%
        opacity 1
        border-left 1px solid hsl(0, 0%, 10%)
      &:before
        content ''
        position absolute
        background hsl(0, 0%, 6%)
        height 20%
        width 5%
        bottom 5%
        right 0%
        border-radius 0 0 50% 25%
        border-left 1px solid hsl(0, 0%, 8%)

    &--bottom
      top 50%
      height 32%

  &__rear-bumper
    position absolute
    height 1px
    width 9%
    background hsl(0, 0%, 50%)
    top 38%
    left 2.5%
    transform-origin top left
    transform rotate(3deg)

  &__side-skirt
    height 1px
    width 43%
    position absolute
    bottom 19%
    left 32%
    transform-origin top left
    transform rotate(1deg)
    background hsl(0, 0%, 50%)

  &__underpanel
    background hsl(0, 0%, 3%)
    height 65%
    width 100%
    position absolute
    bottom 0
    $clip = polygon(2% 0, 14% 100%, 88% 100%, 99% 60%, 99% 40%)
    -webkit-clip-path $clip
    clip-path $clip


  &__mid-body
    --groove hsl(0, 0%, 15%)
    height 100%
    width 100%
    background linear-gradient(84deg, transparent, transparent 36.75%, var(--groove) 36.75%, var(--groove) 37.25%, transparent 37.25%),
      linear-gradient(83deg, transparent, transparent 55.75%, var(--groove) 55.75%, var(--groove) 56.25%, transparent 56.25%),
      linear-gradient(88deg, transparent, transparent 75%, var(--groove) 75%, var(--groove) 75.5%, transparent 75.5%),
      linear-gradient(90deg, transparent, transparent 96%, hsl(0, 0% 12%) 96%),
      linear-gradient(90deg, transparent, hsl(0, 0%, 15%)),
      hsl(0, 0%, 20%)
    $clip = polygon(0 0, 3% 100%, 80% 84%, 99.5% 78%, 100% 10%, 98% 0)
    -webkit-clip-path $clip
    clip-path $clip

    &:after
    &:before
      content ''
      position absolute
      width 4%
      height 4%
      left 38%
      top 6%
      border 1px solid hsl(0, 0%, 30%)
      border-radius 25%

    &:before
      left 58%

  &__window
    --window-black rgba(0, 0, 0, 0.85)
    --window-white rgba(255, 255, 255, 0.3)
    position absolute
    height 80%
    width 60%
    background black
    left 37%
    transform skew(-5deg)
    $clip = polygon(0 100%, 0 55%, 34.5% 11%, 85% 108%)
    -webkit-clip-path $clip
    clip-path $clip


    &-glass
      background linear-gradient(0deg, var(--window-black) 0, var(--window-black) 15%, transparent 15%),
        linear-gradient(90deg, transparent, var(--window-black) 90%),
        linear-gradient(90deg, var(--window-white), transparent 80%),
        linear-gradient(68deg, transparent, transparent 30%, var(--window-black) 30%, var(--window-black) 31%, transparent 31%, transparent 55%, var(--window-black) 55%, var(--window-black) 56%, transparent 56%),
        var(--window-white)
      position absolute
      top 55%
      left 50%
      transform translate(-50%, -50%)
      height 88%
      width 98%
      $clip = polygon(0 100%, 0 55%, 34.5% 11%, 85% 105%)
      -webkit-clip-path $clip
      clip-path $clip

    &:before
      content ''
      background black
      position absolute
      height 10%
      width 100%
      bottom 0
      transform rotate(2deg)
      z-index -1
      $clip = polygon(40% 100%, 100% -100%, 100% 100%)
      -webkit-clip-path $clip
      clip-path $clip
            
          
!
999px

Console