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

              
                <style type="text/css">
    .bs_box {
        background: url(https://blog.kakaocdn.net/dn/bGylEu/btrUQal5KEW/YgwfnrqfK98xEI6njdxHQ1/img.png);
        width: 100%;
        padding: 24px;
        border: 2px solid #333;
        color: #fff;
        margin-bottom: 15px;
    }

    .bs_a {
        background-size: auto;
    }

    .bs_ct {
        background-size: contain;
    }
    .bs_ct2 {
        background-size: contain;
        padding: 77px;
    }

    .bs_c {
        background-size: cover;
    }

    .bs_n {
        background-size: 50px;
    }
    .bs_n2 {
        background-size: 55% 55%;
    }

    .bs_cc {
        background: url(https://blog.kakaocdn.net/dn/0qgT8/btrUHNNpRdO/2k227KseOgrQc8quO4hswK/img.png), url(https://blog.kakaocdn.net/dn/bGylEu/btrUQal5KEW/YgwfnrqfK98xEI6njdxHQ1/img.png);
        background-size: contain, cover;
    }
</style>

<h2>background-size</h2>
<p>배경 이미지 크기 조절</p>
<div class="bs_a bs_box">
    <h3>background-size: auto;</h3>
    <p>기본값</p>
    <p>원본 크기 그대로</p>
    <p>콘텐츠 공간에 맞게 이미지가 잘림</p>
</div>

<div class="bs_ct bs_box">
    <h3>background-size: contain;</h3>
    <p>가로, 세로 비율 유지하며 이미지 다 보임</p>
    <p>콘텐츠 공간에 맞게 이미지가 늘어나거나 줄어듬</p>
</div>
<div class="bs_ct2 bs_box">
    <h3>background-size: contain;</h3>
    <p>가로, 세로 비율 유지하며 이미지 다 보임</p>
    <p>콘텐츠 공간에 맞게 이미지가 늘어나거나 줄어듬</p>
    <p>이미지 해상도 손실</p>
</div>

<div class="bs_c bs_box">
    <h3>background-size: cover;</h3>
    <p>콘텐츠 크기에 맞게 덮음</p>
</div>

<div class="bs_n bs_box">
    <h3>background-size: 수치(px, %...);</h3>
    <p>수치 n; : 가로, 세로 크기 동일</p>
</div>
<div class="bs_n2 bs_box">
    <h3>background-size: 수치(px, %...);</h3>
    <p>수치 n n; : 앞 숫자 가로, 뒷 숫자 세로</p>
</div>

<div class="bs_cc bs_box">
    <h3>background-size: contain, cover;</h3>
    <p>두가지 속성 적용 가능</p>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console