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="container">
        <div class="pic">
            <img src="http://mrszhao.com/zb_users/upload/2019/03/20190325165723155350424327476.jpg">
        </div>
        <div class="content">
            <h2>春季创意,必须来点绿~</h2>
            <p>又到了“设计狮”们开始换毛的季节,脱掉秋裤/毛裤/羽绒裤轻装上阵的同时,也别忘了顺手帮客户爸爸的设计稿们也脱下冬天厚重的外衣,告别属于冬季节日里喜庆又扎眼的配色,换上一身清新自然的春装,带给人耳目一新的惊喜。</p>
        </div>        
    </div>
              
            
!

CSS

              
                *{
        box-sizing: border-box;
    }
    html{
        font-size: 16px;
    }
    body,h2,p{
        margin:0;
    }
    body{
        font-size: 1em;
        font-family: "microsoft Yahei";
        color: #333;
    }
   h2{
       font-weight: normal;
   }
   p{
       line-height: 1.8;
   }
    .container{
        width:calc(100% - 2em);   
        min-width:320px; 
        max-width:1000px;                        
        display: flex;
        justify-content: space-between;
        align-content: center;
        margin: 0 auto;
        padding:1em;
        background-color:#f5f5f5;
    }
    .pic{
        flex:1;
        margin-right: 1em;
    } 
    .pic img{
        width:100%;
    }
    .content{
        flex:3;
        height:8em;
        overflow: hidden;
    }
    .content h2{
        font-size: 1.75em;
    }
    .content p{
        margin-top:0.5em; 
        color:#666;
        text-align: justify;
    }
    @media screen and (max-width:1920px){
        /* 18px+2*(100vw-屏幕最大值)/(屏幕最大值1920-屏幕最小值1600) 
            当屏幕为1920px,字体为18px,当为1600px时,字体为16px。
            */ 
        html{
            font-size:calc(112.5% + 2*(100vw - 1920px)/320);
            font-size:calc(18px + 2*(100vw - 1920px)/320);
        }
    }
    @media screen and (max-width:1600px){
        html{
            /* 16px+(18px-16px)*(100vw-屏幕最大值)/(屏幕最大值1600-屏幕最小值1280) 
            当屏幕为1600px,字体为16px,当为1440px时,字体为15px。
            */
            font-size:calc(100% + 2*(100vw - 1600px)/320);
            font-size:calc(16px + 2*(100vw - 1600px)/320);
        }
    }
    @media screen and (max-width:1280px){
        html{
            /* 14px+(16px-14px)*(100vw-屏幕最大值)/(屏幕最大值1280-屏幕最小值768) 
            当屏幕为1280px,字体为14px,当为1024px时,字体为13px。
            */
            font-size:calc(87.5% + 2*(100vw - 1280px)/512);
            font-size:calc(14px + 2*(100vw - 1280px)/512);
        }
    }
    @media screen and (max-width:768px){        
        html{
            font-size:12px;
        }
        .container{
            width:100%;
        }
    }   
    @media screen and (max-width:425px){      
        .container{
            flex-direction: column;
        }
        .pic{
            margin-right: 0;
            margin-bottom: 1em;
        }
    }
              
            
!

JS

              
                
              
            
!
999px

Console