css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm 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. We'll also process your JavaScript with Babel.

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

Code Indentation

     

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.

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.

            
              <article>
  <h1>
    My submission for "The Humble hr" <br>
    <small>By Jake Albaugh</small>
  </h1>
  <section>
    <p class="big">I wanted to create more than a new style for the hr. Here is a technique that adds value to the user experience.</p>
  </section>
  <section>
    <h4>This hr technique has many use cases</h4>
    <hr><label>Hello</label>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>

    <h4>Use Case 1: Live blogging</h4>
    <hr><label>UPDATE: 2:13pm</label>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>

    <h4>Use Case 2: Sectioning Content</h4>
    <hr><label>3 of 5</label>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>

    <h4>Use Case 3: Progress</h4>
    <hr><label>75% Complete</label>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>
    
    <h4>Any other use you'd like</h4>
    <hr><label>Gimme somma dat hr bidniss on many lines</label>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>
    <p>'We have not cared to live in the place ourselves,' said Lord Canterville, 'since my grand-aunt, the Dowager Duchess of Bolton, was frightened into a fit, from which she never really recovered, by two skeleton hands being placed on her shoulders as she was dressing for dinner, and I feel bound to tell you, Mr. Otis, that the ghost has been seen by several living members of my family, as well as by the rector of the parish, the Rev. Augustus Dampier, who is a Fellow of King's College, Cambridge. After the unfortunate accident to the Duchess, none of our younger servants would stay with us, and Lady Canterville often got very little sleep at night, in consequence of the mysterious noises that came from the corridor and the library.'</p>
  </section>
</article>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Open+Sans:300);

body {
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  font-size: 20px;
  line-height: 2;
  color: #666;
  background: #f9f9f9;
  text-shadow: 1px 1px 0px white;
}

h1 {
  font-weight: 300;
  line-height: 1.2;
  font-size: 1.8em;
}
h1 small {
  color: #c9c9c9;
  font-size: 0.75em;
}

article {
  width: 600px;
  margin: 80px auto;
  position: relative;
}

hr {
  width: 0%;
  min-width: 20%;
  max-width: 100%;
  margin: 0 auto;
  border: none;
  border-bottom: 1px solid #666;
  position: relative;
  transition: box-shadow 200ms ease-in-out;
  box-shadow: 0px 0px 0px 0px #f9f9f9;
}

hr.activated {
  box-shadow: 0px 4px 0px 0px #666;
}

label {
  position: absolute;
  opacity: 0;
  right: 100%;
  margin-right: 4px;
  padding: 4px;
  height: 12px;
  font-size: 14px;
  margin-top: -12px;
  border-radius: 2px 4px;
  transition: opacity 200ms ease-in-out;
  color: #666;
  width: 100px;
  text-align: right;
  line-height: 1.2;
}

hr.activated + label {
  opacity: 1;
}

a {
  text-decoration: none;
  color: #111;
}
            
          
!
            
              var direction_i = 0,
    $window = $(window);

$(document).scroll(function() {
  hr_scroll();
});

hr_scroll();

function hr_scroll() {
  var scroll_top = $window.scrollTop(),
      direction = (scroll_top > direction_i) ? 'up' : 'down',
      direction_i = scroll_top;

  $('hr').each(function() {
    var $this = $(this),
        from_top = $this.offset().top - scroll_top - 100,
        is_activated = $this.hasClass('activated');
    
    if (from_top < 300 && from_top > 0) {
      if (is_activated) {
        $this.removeClass('activated');
      }
      $this.css('width', (100 - (from_top/300) * 100) + '%');
    }

    if (from_top <= 0 && !is_activated) {
      if (direction === 'down') {
        $this.addClass('activated');
      }
    }
    
  });
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console