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

              
                <div class="wrap">
    <!-- 需要在主体div外面再加一个盒子做浮动。主体div两边加两个外边距,用来放置左右两栏。 -->
    <section id="main">
        <div class="content">#content</div>
    </section>
    <aside id="left">#left</aside>
    <aside id="right">#right</aside>
</div>
              
            
!

CSS

              
                 .wrap{
            margin:0 auto;
            width:80%;
        }
        #main{
            width:100%;
            /* 主体div外面的盒子做浮动 */
            float: left;
            background: #ccc;
        }
        #left{
            width:150px;
            float: left;
            height:200px;
            background: #666;
            /* 左栏利用左负外边距回到上个浮动div的最左边。此时的100%就是父容器的宽度。 */
            margin-left: -100%;
        }
        #right{
            width:150px;
            float: left;
            height:200px;
            background: #999;
            /* 右栏利用左负外边距回到上个浮动div的最右边,该边距的值和自己的宽度一致。 */
            margin-left:-150px;
        }
        /* 主体div不浮动,只需要设置好两边的外边距和左右两栏宽度一致即可 */
        .content{
            height:200px;
            margin:0 200px;
        }
              
            
!

JS

              
                
              
            
!
999px

Console