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 id="div_">
    DIV영역
    <p id="p_">
        P영역
        <span id="span_">SPAN영역</span>
    </p>
</div>

<section id="console"><br></section>
              
            
!

CSS

              
                div {
    background-color: #ccc;
    padding: 20px;
    display: block;
}

p {
    background-color: #aaa;
    padding: 20px;
    display: block;
}

span {
    background-color: #888;
    padding: 20px;
    display: block;
}

section {
    background-color: #4477AA;
    padding: 0 10px 30px 20px;
    margin: 50px 0 0 0;
}

section:before {
    background-color: #114477;
    padding: 5px;
    margin: 0 0 0 -20px;
    border-bottom: 2px solid #002244;
    border-bottom-right-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    content:"결과 콘솔";
}
              
            
!

JS

              
                //DIV 영역에 클릭 이벤트 설정
$("#div_").on("click",function(event){
    $("#console").append("<br>DIV 클릭");
});

//P 영역에 클릭 이벤트 설정
$("#p_").on("click",function(event){
    $("#console").append("<br>P 클릭");
});

//SPAN 영역에 첫번째 클릭 이벤트 설정
$("#span_").on("click",function(event){
    $("#console").append("<br>SPAN 클릭1");
    
    //상위로 이벤트가 전파되지 않도록 중단한다.
    event.stopPropagation();
});

//SPAN 영역에 두번째 클릭 이벤트 설정
$("#span_").on("click",function(event){
    $("#console").append("<br>SPAN 클릭2");
    
    //상위로 이벤트가 전파되지 않도록 중단한다.
    event.stopPropagation();
});
              
            
!
999px

Console