Pen Settings

↑ Insert the most common viewport meta tag

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
via CSS Lint

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
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


              <div class="slider-wrap">
  <div class="slider" id="slider">
    <div class="holder">
      <div class="slide" id="slide-0"><span class="temp">74°</span></div>
      <div class="slide" id="slide-1"><span class="temp">64°</span></div>
        <div class="slide" id="slide-2"><span class="temp">82°</span></div>
  <nav class="slider-nav">
    <a href="#slide-0" class="active">Slide 0</a> 
    <a href="#slide-1">Slide 1</a> 
    <a href="#slide-2">Slide 2</a> 


              @import url(;

.slider-wrap {
  width: 300px;
  height: 500px;
  margin: 20px auto;
.slider {
  overflow-x: scroll;
.holder {
  width: 300%;
.slide {
  float: left;
  width: 300px;
  height: 500px;
  position: relative;
  background-position: -100px 0;
.temp {
  position: absolute;
  color: white;
  font-size: 100px;
  bottom: 15px;
  left: 15px;
  font-family: 'Josefin Slab', serif;
  font-weight: 100;
#slide-0 {
  background-image: url(;
#slide-1 {
  background-image: url(;
#slide-2 {
  background-image: url(;
.slide:before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(transparent, black);
.slider-nav {
  text-align: center;
  margin: 10px 0 0 0;
.slider-nav a {
  width: 10px;
  height: 10px;
  display: inline-block;
  background: #ddd;
  overflow: hidden;
  text-indent: -9999px;
  border-radius: 50%;
.slider-nav {
  background: #999;


              var slider = {
  // Not sure if keeping element collections like this
  // together is useful or not.
  el: {
    slider: $("#slider"),
    allSlides: $(".slide"),
    sliderNav: $(".slider-nav"),
    allNavButtons: $(".slider-nav > a")
  timing: 800,
  slideWidth: 300, // could measure this
  // In this simple example, might just move the
  // binding here to the init function
  init: function() {
  bindUIEvents: function() {
    // You can either manually scroll...
    this.el.slider.on("scroll", function(event) {
    // ... or click a thing
    this.el.sliderNav.on("click", "a", function(event) {
      slider.handleNavClick(event, this);
    // What would be cool is if it had touch
    // events where you could swipe but it
    // also kinda snapped into place.
  moveSlidePosition: function(event) {
    // Magic Numbers =(
      "background-position": $( "px 0"
  handleNavClick: function(event, el) {
    var position = $(el).attr("href").split("-").pop();
      scrollLeft: position * this.slideWidth
    }, this.timing);
  changeActiveNav: function(el) {


// Originally added click links, so I ported over and re-wrote
Loading ..................