Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="selectbox">
    <label for="select">드라마</label>
    <select id="select">
        <option selected>드라마</option>
        <option>육룡이 나뻣샤</option>
        <option>그녀는 엿됐다</option>
        <option>애인 없어요</option>
    </select>
</div>
            
          
!
            
              .selectbox {
  position: relative;
  width: 200px;/* 너비설정 */
  
  border: 1px solid #999; /* 테두리 설정 */
  
  z-index: 1;
  
  /* focus 효과*/
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
  -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
  -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

/* focus 효과 */
.selectbox.focus {
  border-color: #66afe9;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
}

/* 가상 선택자를 활용 화살표 대체 */
.selectbox:before {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  width: 0;
  height: 0;
  margin-top: -1px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #313131;
}

.selectbox label {
  position: absolute;
  top: 1px; /* 위치정렬 */
  
  left: 5px; /* 위치정렬 */
  
  padding: .5em .5em; /* select의 여백 크기 만큼 */
  
  color: #333;
  z-index: -1; /* IE8에서 label이 위치한 곳이 클릭되지 않는 것 해결 */
}

.selectbox select {
  width: 100%;
  height: auto;  /* 높이 초기화 */  
  line-height: normal; /* line-height 초기화 */  
  font-family: inherit; /* 폰트 상속 */  
  padding: .8em .5em;  /* 여백과 높이 결정 */  
  border: 0;
  opacity: 0;  /* 숨기기 */ 
  filter: alpha(opacity=0);  /* IE8 숨기기 */
  
  -webkit-appearance: none;  /* 네이티브 외형 감추기 */ 
  -moz-appearance: none;
  appearance: none;
}
            
          
!
            
              $(function() {
  var selectTarget = $('.selectbox select');

  // focus 가 되었을 때와 focus 를 잃었을 때
  selectTarget.on({
    'focus': function() {
      $(this).parent().addClass('focus');
    },
    'blur': function() {
      $(this).parent().removeClass('focus');
    }
  });

  selectTarget.change(function() {
    var select_name = $(this).children('option:selected').text();
    $(this).siblings('label').text(select_name);
    $(this).parent().removeClass('focus');
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console