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 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

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

              
                // Design credits to: Cuberto
// https://dribbble.com/shots/3742706-Find-a-tour-UX-UI-design

head
  link(href="https://fonts.googleapis.com/css?family=Quicksand:400,500" rel="stylesheet")
body
  #wrapper
    h1 Find a place
    #cards
      #cardsWrapper
        .card
          .image(style="background-image: url(https://c1.staticflickr.com/1/343/31652757460_b2b5794a51_n.jpg)")
            .screen
            .text
              p Mountain
              p 2 Days

        .card
          .image(style="background-image: url(https://c2.staticflickr.com/2/1506/25121644830_2d768ef51a_n.jpg)")
            .screen
            .text
              p Island
              p 5 Days

        .card
          .image(style="background-image: url(https://c1.staticflickr.com/1/591/31281062580_e2e3d01cf9_n.jpg)")
            .screen
            .text
              p Valley
              p 3 Days

        .card
          .image(style="background-image: url(https://c1.staticflickr.com/5/4490/38030401362_050e264522_n.jpg)")
            .screen
            .text
              p Forest
              p 4 Days
    #footer
      p Booking rules
      p Terms of use




              
            
!

CSS

              
                =flex()
  display: -webkit-box
  display: -moz-box
  display: -ms-flexbox
  display: -webkit-flex
  display: flex

body
  margin: 70px 0
  padding: 0
  +flex()
  justify-content: center

  font-family: 'Quicksand', sans-serif
  background-color: #F3C937

h1
  position: relative
  margin: 0
  padding: 0
  margin-left: 70px
  margin-top: 65px
  font-weight: 400
  color: #6a6364


p
  padding: 0
  margin: 0

#wrapper
  position: relative
  width: 900px
  height: 470px
  background: linear-gradient(#fff8f1, #F7EFCD)
  box-shadow: 0 10px 60px rgba(0, 0, 0, 0.30)
  overflow: hidden

  &:before
    position: absolute
    content: ""
    width: 500px
    height: 500px
    border-radius: 250px
    background: linear-gradient(#FBEFD9, #F7E7BF)
    right: -150px
    bottom: -70px

#cards
  +flex()
  position: relative
  padding-bottom: 60px
  padding-top: 40px
  padding-left: 50px
  overflow: scroll


  &::-webkit-scrollbar
    display: none
  
#cardsWrapper
  +flex()
  padding-right: 50px
  

.card
  width: 320px
  height: 223px
  perspective: 500px

  margin: 0 23px
  flex-shrink: 0

.image

  position: absolute
  width: 100%
  height: 100%

  box-shadow: 0 20px 40px -20px rgb(157, 107, 35)

  -webkit-transform-style: preserve-3d
  transform-style: preserve-3d

  -webkit-transition: all 0.2s linear
  transition: all 0.2s linear

  background-size: cover

.screen
  position: absolute
  width: 100%
  height: 100%
  background-color: rgba(0, 0, 0, 0.22)
  transform: translateZ(35px) scale(0.93)

.text
  position: absolute
  bottom: 25px
  left: 30px
  color: white
  transform: translateZ(35px) scale(0.93)
  font-family: 'Quicksand', sans-serif

  p
    cursor: default

  p:first-of-type
    font-weight: 500
    font-size: 2em
    margin-bottom: 5px
  p:last-of-type
    font-weight: 400
    font-size: 0.9em


#footer
  +flex()
  justify-content: space-between
  position: relative
  width: 140px
  margin-left: 72px

  p
    margin: 0
    padding: 0
    text-indent: 2px
    font-weight: 400
    font-size: 0.5rem
    color: #6a6364
    cursor: pointer
              
            
!

JS

              
                $(function(){
    var card = $(".card");

    card.on('mousemove', function (e) {
        var x = e.clientX + $(window).scrollLeft() - $(this).offset().left;
        var y = e.clientY + $(window).scrollTop()- $(this).offset().top;

        var rY = map(x, 0, $(this).width(), -17, 17);
        var rX = map(y, 0, $(this).height(), -17, 17);

        $(this).children(".image").css("transform", "rotateY(" + rY + "deg)" + " " + "rotateX(" + -rX + "deg)");
    });

    card.on('mouseenter', function () {
        $(this).children(".image").css({
                transition: "all " + 0.05 + "s" + " linear",
                WebkitTransition: "all " + 0.05 + "s" + " linear"
        });
    });

    card.on('mouseleave', function () {
        $(this).children(".image").css({
            transition: "all " + 0.2 + "s" + " linear",
            WebkitTransition: "all " + 0.2 + "s" + " linear"
        });

        $(this).children(".image").css("transform", "rotateY(" + 0 + "deg)" + " " + "rotateX(" + 0 + "deg)");
    });

    function map(x, in_min, in_max, out_min, out_max)
    {
        return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    }
});
              
            
!
999px

Console