cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
   <script>
    window.onload = function() {
 			var newselect = Selectyle('select');
   }
	</script>
</head>
<body>
	<select>
		<option value="1">Red</option>
		<option value="2">Yellow</option>
		<option value="3">Blue</option>
		<option value="4">Green</option>
		<option value="5" selected="selected">Orange</option>
		<option value="6">Purple</option>
		<option value="7">Black</option>
		<option value="8">White</option>
	</select>
</body>
</html>
            
          
!
            
              .selectyle-wrapper, .selectyle-span, .selectyle-wrapper select {
    height: 32px; /** Height and line-height values need to be the same  **/
    line-height: 32px;
}

.selectyle-wrapper {
    /** A select with rounded corners YAY */
    border-radius: 5px;

    /** Add the arrow as a background image and set a background color if you like **/
    background-color: #e3e8f2;
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAcCAMAAACu5JSlAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGlQTFRFAAAABQcKFB4qFR8rBggMBwoOFR8sCAwRAQECAAABAwQGBwsPBgkNAwUHCQ0SCxEXDRMbChAWEBchMktpMktpMktpMktpMktpMktpMktpMktpMktpMktpMktpMktpMktpMktpMktp////TWtutQAAACF0Uk5TAAAAAAAAAAAAAAAAAAAAAAAAADz5RSTwTvxLaZADsQnAqJlFbQAAAAFiS0dEIl1lXKwAAAAJcEhZcwAAAEgAAABIAEbJaz4AAABvSURBVCjP7dK3EoAgEEVRxQQKKCYMBPn/n3QcsFus7PS2p9o3myR/75SiLIRyyIvy9rKCfBhdaJwgn+XtcoYcL6vndSOQ18XufW9q8ADK1MWK0ciFXBvnjObRCVp7HLaNT0Q6ITrysCHue/ytrzkBVJkITdL2aysAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTItMTEtMDlUMjM6Mzc6NDktMDU6MDDsGK6SAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEyLTExLTA5VDIzOjM3OjQ5LTA1OjAwnUUWLgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAASUVORK5CYII=);
    background-repeat:  no-repeat;

    /** Position the arrow to the right,
    ** TIP : add some space to the right of your arrow image so it's not too close to the right border
    **/
    background-position: right center;

    /** Select border **/
    border: 1px solid #238db1;

    /** Set the minimum width **/
    min-width: 150px;

    /** If you set the maximum width or width, then overflow: hidden; will be required **/
    /*
    max-width: 300px;
    width: 300px;
    overflow: hidden;
    */

    /** Push the arrow to the right, away from the text **/
    padding-right: 35px;

}
.selectyle-span {
    /** Set a border between the text and the arrow **/
	  border-right: 1px solid #aaa;

    /** Text color **/
    color: #334b65;

    /** Add some padding-left so the text is not too close to the select border **/
    padding-left: 5px;
}

/*
 ************************************************
 * DO NOT TOUCH THE FOLLOWING                   *
 * https://www.youtube.com/watch?v=NyEE0qpfeig   *
 * **********************************************
 * These are the properties required so that the plugin can work correctly
 */
.selectyle-wrapper {
    position : relative;
    display : inline-block;
}
.selectyle-span {
    display : block;
    width : 100%;
}
.selectyle-wrapper select {
    opacity : 0;
    filter : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
    left : 0;
    position : absolute;
    top : 0;
    width : 100%;
}
            
          
!
            
              /*! Selectyle - Mini javascipt to style <select> elements - v0.1.0 - 2013-04-25
* https://github.com/jeromesmadja/selectyle
* Copyright (c) 2013 Jerome Smadja; Licensed MIT */
var _Selectyle={init:function(e){var t=e.length;if(0===t)return!1;for(var n=t-1;n>=0;n--){if("SELECT"!==e[n].nodeName)return!1;var a=e[n],c=document.createElement("div"),i=document.createElement("span");c.className="selectyle-wrapper",i.className="selectyle-span",a.parentNode.appendChild(c),c.appendChild(i),i.parentNode.insertBefore(a,i.nextSibling),this.updateSpan(a,i),this.addEvent(a,"keydown",this.keydown(a)),this.addEvent(a,"change",this.change(a,i))}},addEvent:function(e,t,n){"function"==typeof e.addEventListener?e.addEventListener(t,n,!1):"object"==typeof e.attachEvent&&e.attachEvent("on"+t,n)},updateSpan:function(e,t){setTimeout(function(){t.innerHTML=e.options[e.selectedIndex].text},5)},keydown:function(e){return function(){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),e.dispatchEvent(t)}},change:function(e,t){return function(){_Selectyle.updateSpan(e,t)}}},Selectyle=function(e){var t=document.querySelectorAll(e);_Selectyle.init.call(_Selectyle,t)};
            
          
!
999px
Loading ..................

Console