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

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

              
                <h2>.addClss()与.css()方法区别</h2>
<div class="left">
  <div class="aaron">
    <a>css优先级高于addClass</a>
    <a>1:第一次addClss背景色</a>
    <a>2:第二次css修改背景色</a>
  </div>
</div>
<div class="right">
  <div class="aa bb imooc">
    <article>
      <a>imoocClass</a>
    </article>
  </div>
</div>
              
            
!

CSS

              
                .left,
.right {
  width: 300px;
  height: 120px;
}

.left div,
.right div {
  width: 200px;
  height: 90px;
  padding: 5px;
  margin: 5px;
  float: left;
}
a {
  font-size: 14px;
  display: block;
}
.newClass {
  background: #bbffaa;
}

.imoocClass {
  background: red;
}
.addBorder {
  border: 1px solid red;
}

              
            
!

JS

              
                //给所有的div统一增加边框
$("div").addClass("addBorder");
//class=left下div元素增加一个新的样式,增加背景颜色
$(".aaron").addClass("newClass");
//通过css覆盖addClass方式设置背景色
$(".aaron").css({
  background: "yellow"
});

              
            
!
999px

Console