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="widget">
  <div class="title">Car Rental</div>
  
  <div class="cars">
    <figure class="car">
      <img src="//umetov.com/bgs/carwidget/ford.png" alt="ford">
      <figcaption>
        2013 Ford Mustang <br><span class="sub">Convertible </span> 
      </figcaption>
    </figure>
    
    <figure class="car">
      <img src="//umetov.com/bgs/carwidget/chevrolet.png" alt="chevrolet">
      <figcaption>
        Chevrolet  Camaro <br><span class="sub">Convertible </span> 
      </figcaption>
    </figure>
    
    <figure class="car">
      <img src="//umetov.com/bgs/carwidget/audi.png" alt="audi">
      <figcaption>
        Audi   <br><span class="sub">Convertible </span> 
      </figcaption>
    </figure>
        
    <span class="left"></span>
    <span class="right"></span>
  </div>
      
  <div class="info">
    <div class="book">BOOK</div>
    Best Price <br>
    <span class="price"> $125/<span class="sub-price">DAY</span>
    </span>
  </div>
</div>
              
            
!

CSS

              
                @import "compass/css3";

$w: 330px;
$h: 380px;

* {
 @include box-sizing(border-box);
 @include transition(all 0.2s cubic-bezier(1,.18,1,.93));
}

body {
  background:  rgba(100,100,100,1);
  font: bold 16px Arial, sans-serif;
  line-height: 1;
  color: #ffffff;
}

figure, figcation {
  padding: 0;
  margin: 0;
}

.widget {
    width: $w;
    height: $h;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -$h/2;
    margin-left: -$w/2;
  
    .title {
      @include background-image(linear-gradient(top, #3fa9db 0%,#2796ca 100%));
      @include background-image(-ms-linear-gradient(top, #3fa9db 0%,#2796ca 100%));
      height: 50px;
      line-height: 50px;
      padding-left: 20px;
      @include box-shadow(inset 1px 1px 0 0 rgba(255,255,255,0.35));
    
      @include text-shadow(1px 1px 1px rgba(0,0,0,0.35));
    }
  
    .cars {
      position: relative;
      padding: 25px 0;
      background: #ffffff;    
      text-align: center;
      overflow: hidden;
      white-space: nowrap;
      font-size: 0px;
    
      .car {
        display: inline-block;
        width: 100%;
        
      
        figcaption {
          color: #444444;
          font-size: 18px;
      
          .sub {
            font-size: 14px;
          }
        }
      }
    }
    
    .info {
      padding: 25px 0;
      padding-left: 20px;
      background: #ededed;
      color: #444444;
      font-size: 12px;
      
      .price {
        font-size: 26px;
        .sub-price {
          font-size: 18px;
        }
      }
      
      .book {
        float: right;
        @include background-image(linear-gradient(top, #939388 0%,#848478 100%));
        width: 90px;
        height: 40px;
        text-align: center;
        line-height: 40px;
        
        cursor: pointer;      
        font-size: 14px;
        color: #ffffff;
        @include text-shadow(1px 1px 1px rgba(0,0,0,0.35));
      
        &:hover {
            @include background-image(linear-gradient(top, #3fa9db 0%,#2796ca 100%));
        }
      }
    }
  
  
    .left, .right {
       position: absolute;
       bottom: 20px;
       width: 40px;
       height: 40px;
       background: #cccccc  url("//umetov.com/bgs/carwidget/arrows_.png") no-repeat center left;
       cursor: pointer;
          
      &:hover {
         background-position: center right;
      }
    }
  
    .left {
      left: 0;
      @include transform(rotate(180deg));
    }
  
    .right {
      right: 0;
    }
}
              
            
!

JS

              
                w = $('.cars .car').width();
count = $('.cars .car').length;

$('.right').click(function () {
  if($('.cars .car:first-child').css('margin-left')==-(count-1)*w + 'px') {
      $('.cars .car:first-child').css({'margin-left': '0'});
  } else {
      $('.cars .car:first-child').css({'margin-left': '-=' + w});
  }
 });
$('.left').click(function () {
    if($('.cars .car:first-child').css('margin-left')=='0px') {
      $('.cars .car:first-child').css({'margin-left': -(count-1)*w + 'px'});
  } else {
      $('.cars .car:first-child').css({'margin-left': '+=' + w});
  }
 });
//прости меня, Боженька, за этот говнокод
              
            
!
999px

Console