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

              
                
<div class="layout">
  <h4>默认</h4>
  <div class="box">
    Most words are short & don't need to break. But <b class="orange">Antidisestablishmentarianism</b> is too long.</div>
</div>
<div class="layout">
  <h4>字符超出部分自动换行</h4>
  <div class="box">
    Most words are short & don't need to break. But <b class="wrap orange">Antidisestablishmentarianism</b> is too long.</div>
</div>
<div class="layout">
  <h4>字符超出位置使用连字符</h4>
  <div class="box">
    Most words are short & don't need to break. But <b class="hyphens orange">Antidisestablishmentarianism</b> is too long.</div>
</div>
<div class="layout">
  <h4>单行溢出省略</h4>
  <div class="box ellipsis">
    Most words are short & don't need to break. But <b>Antidisestablishmentarianism</b> is too long.</div>
</div>
<div class="layout">
  <h4>多行溢出省略</h4>
  <div class="box line-clamp">
    Most words are short & don't need to break. But <b>Antidisestablishmentarianism</b> is too long.</div>
</div>
              
            
!

CSS

              
                .layout {
  width: 180px;
  margin: 50px auto;
}
.layout .orange {
  color: orange;
}
h4 {
  margin: 10px 0;
  position: relative;
}
h4::before {
  content: '#';
  display: block;
  color: #41b883;
  position: absolute;
  font-size: 18px;
  line-height: 22px;
  left: -18px;
  top: 0;
}
.box {
  border: 1px solid #ddd;
}
.wrap {
  overflow-wrap: break-word;
}
.hyphens {
  hyphens: auto;
}
.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-clamp {
  overflow : hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
              
            
!

JS

              
                
              
            
!
999px

Console