Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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.has-lines Example Title

h1.has-lines Fusce dapibus, tellus ac cursus commodo, tortor mauris

p.has-lines or

p.has-lines Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus donec sed odio dui.

p.has-lines
  button Action here


.description
  p Uses flexbox to avoid the need for nested elements, or using overflow hidden to mask super-long absolutely-positioned lines.

  p This technique works in all decent browsers, including IE11+. IE10 requires some legacy flexbox syntax and some extra tweaks but also displays as expected.

  p IE9 and earlier show partial lines (at the pseudo-element’s min-width), but still looks passable. If content wraps to multiple lines, the after element drops too. Depending on design, I'd use a  #[code .flexbox] Modernizr class to either hide the lines or would revert to an older method where absolute positioning, super-wide fixed-width lines, and overflow hidden are used.
              
            
!

CSS

              
                $lines--content-gutter = 10px
$lines--min-width = 40px

.has-lines
  display flex
  align-items center
  text-align center
  
  // IE10
  justify-content center

  &:before
  &:after
    content ''
    flex-grow 1
    height 1px
    background #ccc
    min-width $lines--min-width
    
    // IE10
    display inline-block
    
    // IE9
    vertical-align middle

  &:before
    margin-right $lines--content-gutter

  &:after
    margin-left $lines--content-gutter

body
  padding 30px

.description
  color #777
  max-width 500px
  margin 50px auto
              
            
!

JS

              
                
              
            
!
999px

Console