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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <h1>.xOpt</h1>
<p><code>.xOpt</code>는 단일 또는 다중 선택 콘트롤을 사용자 정의했다. 콘트롤 또는 조상 <code>fieldset</code> 요소에 <code>disabled</code> 속성을 사용할 수 있다. 접근성 지침을 준수하고 터치 단말에 대응하기 위해 콘트롤 영역의 최소 크기를 48px 이상으로 처리했다. IE 브라우저는 지원하지 않는다.</p>

<section>
    <h2>.xRadio</h2>
    <p><code>.xRadio</code>는 단일 선택 기능을 제공한다.</p>
    <fieldset>
        <legend>.xRadio</legend>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-1" type="radio">
            <span class="xOpt__label xRadio__label">라디오</span>
        </label>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-1" type="radio" checked>
            <span class="xOpt__label xRadio__label">라디오</span>
        </label>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-1" type="radio" disabled>
            <span class="xOpt__label xRadio__label">라디오:disabled</span>
        </label>
    </fieldset>
    <fieldset disabled>
        <legend>:disabled .xRadio</legend>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-2" type="radio">
            <span class="xOpt__label xRadio__label">라디오</label>
        </label>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-2" type="radio" checked>
            <span class="xOpt__label xRadio__label">라디오</label>
        </label>
        <label class="xOpt xRadio">
            <input class="xOpt__btn" name="xRadio-2" type="radio" disabled>
            <span class="xOpt__label xRadio__label">라디오</label>
        </label>
    </fieldset>
    <label class="xOpt xRadio">
        <input class="xOpt__btn" name="xRadio-3" type="radio">
        <span class="xOpt__label xRadio__label">라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 라디오 문자 줄바꿈 테스트 <a href="#">링크 추가 테스트</a></span>
    </label>
</section>

<section>
    <h2>.xCheck</h2>
    <p><code>.xCheck</code>는 다중 선택 기능을 제공한다.</p>
    <fieldset>
        <legend>.xCheck</legend>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox">
            <span class="xOpt__label xCheck__label">체크박스</span>
        </label>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox" checked>
            <span class="xOpt__label xCheck__label">체크박스</span>
        </label>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox" disabled>
            <span class="xOpt__label xCheck__label">체크박스:disabled</span>
        </label>
    </fieldset>
    <fieldset disabled>
        <legend>:disabled .xCheck</legend>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox">
            <span class="xOpt__label xCheck__label">체크박스</span>
        </label>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox" checked>
            <span class="xOpt__label xCheck__label">체크박스</span>
        </label>
        <label class="xOpt xCheck">
            <input class="xOpt__btn" type="checkbox" disabled>
            <span class="xOpt__label xCheck__label">체크박스</span>
        </label>
    </fieldset>
    <label class="xOpt xCheck">
        <input class="xOpt__btn" type="checkbox">
        <span class="xOpt__label xCheck__label">체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 체크박스 문자 줄바꿈 테스트 <a href="#">링크 추가 테스트</a></span>
    </label>
</section>
              
            
!

CSS

              
                /* .xOpt */
.xOpt {
    position: relative;
    box-sizing: border-box;
    display: inline-block;
    align-items: center;
    font-size: 16px;
    cursor: default;
    --control-border-color: darkslategray;
    --control-bg-color: white;
    --control-checked-color: red;
    --text-default-color: darkslategray;
    --text-checked-color: black;
    --text-disabled-color: silver;
    --outline-color: royalblue;
}
[hidden].xOpt { display: none; }
.xOpt__btn {
    position: absolute;
    opacity: 0;
}
.xOpt__label {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    line-height: 20px;
    width: 100%;
    padding: 16px 16px 12px 44px;
    color: var(--text-default-color);
    vertical-align: top;
    text-align: left;
}
.xOpt__label::before,
.xOpt__label::after {
    position: absolute;
    box-sizing: border-box;
    top: 24px;
    left: 16px;
    transform: translateY(-50%);  
}
.xOpt__label::before {
    content: '';
    border: 2px solid var(--control-border-color);
    background: var(--control-bg-color);
    opacity: .6;
}
:checked + .xOpt__label::after { content: ''; }
:focus + .xOpt__label,
:checked + .xOpt__label { color: var(--text-checked-color); }
:focus + .xOpt__label::before,
:checked + .xOpt__label::before { opacity: 1; }
:focus + .xOpt__label { outline: 4px auto var(--outline-color); }
@media (hover) {
    :hover > .xOpt__label { color: var(--text-checked-color); }
    :hover > .xOpt__label::before { opacity: 1; }
}
:disabled .xOpt__label,
:disabled + .xOpt__label {
    color: var(--text-disabled-color);
    cursor: not-allowed;
    filter: grayscale(100%);
}
:disabled .xOpt__label::before,
:disabled .xOpt__label::after,
:disabled + .xOpt__label::before,
:disabled + .xOpt__label::after { opacity: .33; }

/* .xRadio */
.xRadio__label::before {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}
.xRadio__label::after {
    width: 10px;
    height: 10px;
    margin-left: 5px;
    background: var(--control-checked-color);
    border-radius: 50%;
}
:checked + .xRadio__label::before { border-color: var(--control-checked-color); }

/* .xCheck */
.xCheck__label::before {
    width: 18px;
    height: 18px;
    border-radius: 2px;
}
.xCheck__label::after {
    width: 12px;
    height: 6px;
    margin: -5px 0 0 3px;
    border: 2px solid var(--control-bg-color);
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg);
}
:checked + .xCheck__label::before {
    border: 0;
    background: var(--control-checked-color);
}


              
            
!

JS

              
                
              
            
!
999px

Console