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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                h1 Scroll horizontally
.wrapper
  .row
    - 8.times do |n|
      .column #{n+1}
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Gloria+Hallelujah'

$color-gray: #9DA0B0
$color-bg: #7B7CFF
$tile-size: 80px

=centerer($horizontal:true, $vertical:true)
  position: absolute
  display: block
  @if $horizontal and $vertical
    top: 50%
    left: 50%
    transform: translate(-50%, -50%)
  @else if $horizontal
    left: 50%
    transform: translate(-50%, 0)
  @else if $vertical
    top: 50%
    transform: translate(0, -50%)

=grad($direction: left)
  $oposite-direction: right
  @if $direction == right
    $oposite-direction: left
  $color: mix($color-bg, black, 50%)
  $opacity: .8
  background: -moz-linear-gradient(#{$direction},  rgba($color, $opacity) 0%, rgba($color, 0) 100%)
  background: -webkit-linear-gradient(#{$direction},  rgba($color, $opacity) 0%,rgba($color, 0) 100%)
  background: linear-gradient(to #{$oposite-direction},  rgba($color, $opacity) 0%,rgba($color, 0) 100%)

*, *:before, *:after
  box-sizing: border-box

html, body
  height: 100%
  margin: 0
  padding: 0
  font-family: Arial, sans-serif
  background: $color-bg

h1
  +centerer
  top: calc(50% - #{$tile-size*1.5}) !important
  line-height: 1.4em
  font-family: 'Gloria Hallelujah', sans-serif
  text-align: center
  color: white

.wrapper
  width: 300px
  height: $tile-size
  +centerer
  border-radius: 10px
  border: 4px solid mix(black, $color-bg, 30%)
  font-size: 0
  background: #f7f9f9
  box-shadow: 0 15px 24px rgba(black, 0.22), 0 19px 76px rgba(black, 0.3)
  .shadows
    width: 100%
    height: 100%
    position: absolute
    top: 0
    left: 0
    pointer-events: none
    border-radius: 5px
    overflow: hidden
    & > div
      width: 55px
      max-width: 55px
      height: 100%
      position: absolute
      top: 0
      transition: all .125s ease
    .shadow__left
      // width: 0px
      opacity: 0
      left: 0
      +grad(left)
    .shadow__right
      right: 0
      +grad(right)
  .row
    width: auto
    height: 100%
    border-radius: 10px
    overflow: hidden
    overflow-x: scroll
    overflow-y: hidden
    white-space: nowrap
    .column
      width: $tile-size
      height: 100%
      line-height: $tile-size
      font-size: 40px
      text-align: center
      display: inline-block
      vertical-align: middle
      border-right: 1px solid #EAEDF0
      color: #A6ACB0
      background: white
              
            
!

JS

              
                var elem = document.querySelector('.row');

addGrad(elem);

function addGrad(elem) {
  var fadeScrollOffset = 10;
  var elemParent = elem.parentNode;
  if(elem.scrollWidth > elemParent.offsetWidth) {
    var divElem = document.createElement('div');
    divElem.className = "shadows";
    var divShadows =
      '<div class="shadow__left"></div>' +
      '<div class="shadow__right"></div>';
    divElem.innerHTML = divShadows;
    elem.insertBefore(divElem, elem.firstChild);
    var divShaLeft = document.querySelector('.shadow__left');
    var divShaRight = document.querySelector('.shadow__right');

    elem.onscroll = function() {
      if(this.scrollLeft > fadeScrollOffset) {
        divShaLeft.style.opacity = 1;
        divShaLeft.style.width = "55px";
      }
      else {
        divShaLeft.style.opacity = 0;
        divShaLeft.style.width = "0px";
      }
      if(this.scrollWidth - this.clientWidth - this.scrollLeft < fadeScrollOffset) {
        divShaRight.style.opacity = 0;
        divShaRight.style.width = "0px";
      }
      else {
        divShaRight.style.opacity = 1;
        divShaRight.style.width = "55px";
      }
    }
  }
}
              
            
!
999px

Console