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

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

CSS

              
                @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;
}
              
            
!

JS

              
                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

Console