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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 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.

HTML

              
                <!DOCTYPE html>
<html>
<head>
	<title>Lbrary - Compl&eacute;tez votre librairie !</title>
	<link rel="stylesheet" type="text/css" href="style.css">
	<script type="text/javascript" src="script.js"></script>
	<script type="text/javascript" src="select.js"></script>
	<!-- Google Fonts -->
	<link href="https://fonts.googleapis.com/css?family=Sansita" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Vollkorn" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Old+Standard+TT" rel="stylesheet">
</head>
<body>
    <ul class="ul_nav">
    	<li><a href="select.php">Consulter la librairie</a></li>
    	<li><a href="index.php" class="active_nav">Agrandir la librairie</a></li>
    	<li class="about"><a href="about.html">About</a>
    </ul>

	<form action="insert.php" method="post" id="Book" class="Book">	
	<h1>Compl&eacute;tez votre collection !</h1>
<!-- 	<div id="sendmessage"> Ajout du livre effectu&eacute;! </div>												-->
		<ul>
		<li>
		    <input type="text" name="name" id="name" placeholder="Auteur">
			<select name="type" form="Book" class="turnintoturnintodropdown_demo2">
				<option>Type</option>
				<option value="ROMAN IND.">Roman Ind.</option>
				<option value="ROMAN SAGA">Roman Saga</option>
				<option value="BD">BD</option>
				<option value="MANGA">Manga</option>
				<option value="DOCUMENTAIRE">Documentaire</option>
				<option value="JEUNESSE">Jeunesse</option>
			</select>
		</li>
		<li>
        	<input type="text" name="title" id="title" placeholder="Titre">
        	<select name="genre" form="Book" class="turnintoturnintodropdown_demo2">
        		<option>Genre</option>
				<option value="POLICIER">Policier</option>
				<option value="FANTASTIQUE">Fantastique</option>
				<option value="HORREUR">Horreur</option>
				<option value="POESIE">Po&eacute;sie</option>
				<option value="THEATRE">Th&eacute;&acirc;tre</option>
				<option value="SCI-FIC">Science-Fiction</option>
				<option value="EROTIQUE">&Eacute;rotique</option>
			</select>
        </li>
        <li>
        	<input type="text" name="rank" id="rank" placeholder="N&#176;">
    		<select name="owned" form="Book" class="turnintoturnintodropdown_demo2">
    			<option>Poss&eacute;d&eacute; ?</option>
		    	<option value="Oui">Oui</option>
    			<option value="Non">Non</option>
    		</select>
		</li>
		</ul>
		<br />
    	<input type="submit" value="Ajouter" class="submit_button">
	</form>
</body>
</html>
              
            
!

CSS

              
                body {
	font-family: 'Sansita', sans-serif;
	padding: 0;
	padding-top:50px;
	margin: 0;
	background-color: #000000;
	background-image: url("img/background.jpg");
	background-repeat: no-repeat;
	background-position: right;
	background-attachment: fixed;
}

/*nav bar*/
.ul_nav {
	font-family: 'Vollkorn', serif;
	display: inline-block;
    list-style-type: none;
    margin: 0;
    padding: 0;
    padding-left: 10%;
    padding-right: 10%;
    overflow: hidden;
    background-color: rgba(51, 51, 51, 0.75);
    top: 0;
    width:100%;
    position: fixed;
}

.ul_nav li {
    float: left;
    min-width: 150px;
}

.ul_nav li a {
    display: block;
    height:17px;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

.ul_nav li a:hover {
    background-color: rgba(17, 17, 17, 0.4);
}

.ul_nav li .active_nav {
    background-color: rgba(33, 90, 138, 0.4);
}

.ul_nav li .active_nav:hover {
	background-color: rgba(29, 81, 124, 0.4);
}
.ul_nav .about
{
	float: right;
	padding-right: 10%;
}

h1 {
	font-family: "Old Standard TT", "serif";
	text-align: center;
	letter-spacing: 3px;
	color: #ffffff;
	margin: auto;
}

.Book {
	text-align: center;
	margin: auto;
	margin-top: 50px;
	width: 600px;
	padding-top: 10px;
	padding-bottom: 10px;
	background: rgba(22, 42, 60, 0.8);
    box-shadow: 1px 1px 25px rgba(255, 255, 255, 0.5);
	border-radius: 20px;
	border: 6px solid rgba(38, 138, 33, 0.5);
	overflow: visible;
}

.Book ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
}

.Book ul li {
	position: auto;
	margin: auto;
	padding: 0;
}

input {
	font-family: 'Sansita', sans-serif;
	color: #fff;
	background: rgba(166, 209, 245, 0.4);
	border: 2px solid #fff;
	border-radius: 5px;
	font-size: 28px;
	margin: 10px;
	width: 240px;
	padding: 0px 10px 5px 10px;
	outline: none;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}
input:focus {
    background-color: rgba(17, 17, 17, 0.4);
}
.submit_button {
	cursor: pointer;
    background-color: rgba(33, 90, 138, 0.4);
	text-align: center;
	margin: auto;
}

.submit_button:hover {
	cursor: pointer;
    background-color: rgba(17, 17, 17, 0.4);
	text-align: center;
	margin: auto;
}

/*change la couleur des placeholder*/
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
  color: #fff;
}
::-moz-placeholder { /* Firefox 19+ */
  color: #fff;
}
:-ms-input-placeholder { /* IE 10+ */
  color: #fff;
}
:-moz-placeholder { /* Firefox 18- */
  color: #fff;
}

/*.Book ul li select {
	/*permet de redimension select comme le reste
	-ms-box-sizing:content-box;
	-moz-box-sizing:content-box;
	-webkit-box-sizing:content-box; 
	box-sizing:content-box;

	font-family: 'Sansita', sans-serif;
	color: #fff;
	background: rgba(166, 209, 245, 0.4);
	border: 2px solid #fff;
	border-radius: 5px;
	font-size: 28px;
	margin: 10px;
	width: 240px;
	padding: 0px 10px 5px 10px;
	outline: none;
}*/
/* css pour la liste <select>, obtenu sur http://www.scribbletribe.com/how-to-style-the-select-dropdown/*/

.dropcontainer {
	position:absolute;
	font-size: 16px;
	color: #fff;
	} 

.trigger {
	color: #fff;
	padding: 0px 10px 5px 10px;
	font-size: 28px;
	width: 240px;
	background: rgba(166, 209, 245, 0.4);
	display: block;
	border: 2px solid #fff;
	border-radius: 5px;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	-webkit-transition: all 0.5s ease;
	-moz-transition: all 0.5s ease;
	-o-transition: all 0.5s ease; 
	transition: all 0.5s ease;
	text-decoration: none;
	}

.trigger:hover {
	color: #fff;
    background-color: rgba(17, 17, 17, 0.4);
	}

.activetrigger {
	text-decoration: none;
	color: #fff;
	padding: 0px 10px 5px 10px;
	font-size: 28px;
	width: 240px;
    background-color: rgba(17, 17, 17, 0.4);
	display: block;
	border: 2px solid #fff;
	border-radius: 5px 5px 0px 0px;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	}

.activetrigger:hover {
    background-color: rgba(17, 17, 17, 0.4);
	color: #fff;
	}

.activetrigger:active {
    background-color: rgba(17, 17, 17, 0.4);
	color: #fff;
	}

.dropcontainer ul {
	font-size: 18px;
	border: 1px solid #fff;
	border-top: none;
	border-radius: 0 0 5px 5px;
	background: rgba(80, 104, 123, 0.9);
	list-style-type: none;
	padding: 0;
	margin: 0;
	width: 240px;
	z-index: 100;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	}

.dropcontainer ul li {
	padding: 10px 5px;
	border-radius: 5px;
	border-bottom: 1px dashed rgba(0,0,0,0);
	border-top: 1px dashed rgba(0,0,0,0);
	-webkit-transition: all 0.5s ease; 
	-moz-transition: all 0.5s ease; 
	-o-transition: all 0.5s ease; 
	transition: all 0.5s ease;
	cursor: pointer;
	}

.dropcontainer ul li:NTH-CHILD(2) {
	border-radius: 0 0 5px 5px;
	
}
.dropcontainer ul li a {
	color: #fff;
	text-decoration: none;
}

.dropcontainer ul li:hover {
    background-color: rgba(17, 17, 17, 0.4);
    color: #fff;
	outline: none;
	border-bottom: 1px dashed #fff;
	border-top: 1px dashed #fff;
	}

.dropcontainer ul li:first-child {
	display: none;
	}


.turnintodropdown_demo2hidden {
	display: none;
	}

.turnintodropdown_demo2visible {
	height: auto;
	}


/* fin du css <select>*/
              
            
!

JS

              
                function tamingselect()
{
	if(!document.getElementById && !document.createTextNode){return;}
	
// Classes for the link and the visible turnintodropdown_demo2
	var ts_selectclass='turnintoturnintodropdown_demo2'; 	// class to identify selects
	var ts_listclass='turnintoselect';		// class to identify ULs
	var ts_boxclass='dropcontainer'; 		// parent element
	var ts_triggeron='activetrigger'; 		// class for the active trigger link
	var ts_triggeroff='trigger';			// class for the inactive trigger link
	var ts_turnintodropdown_demo2closed='turnintodropdown_demo2hidden'; // closed turnintodropdown_demo2
	var ts_turnintodropdown_demo2open='turnintodropdown_demo2visible';	// open turnintodropdown_demo2
/*
	Turn all selects into DOM turnintodropdown_demo2s
*/
	var count=0;
	var toreplace=new Array();
	var sels=document.getElementsByTagName('select');
	for(var i=0;i<sels.length;i++){
		if (ts_check(sels[i],ts_selectclass))
		{
			var hiddenfield=document.createElement('input');
			hiddenfield.name=sels[i].name;
			hiddenfield.type='hidden';
			hiddenfield.id=sels[i].id;
			hiddenfield.value=sels[i].options[0].value;
			sels[i].parentNode.insertBefore(hiddenfield,sels[i])
			var trigger=document.createElement('a');
			ts_addclass(trigger,ts_triggeroff);
			trigger.href='#';
			trigger.onclick=function(){
				ts_swapclass(this,ts_triggeroff,ts_triggeron)
				ts_swapclass(this.parentNode.getElementsByTagName('ul')[0],ts_turnintodropdown_demo2closed,ts_turnintodropdown_demo2open);
				return false;
			}
			trigger.appendChild(document.createTextNode(sels[i].options[0].text));
			sels[i].parentNode.insertBefore(trigger,sels[i]);
			var replaceUL=document.createElement('ul');
			for(var j=0;j<sels[i].getElementsByTagName('option').length;j++)
			{
				var newli=document.createElement('li');
				var newa=document.createElement('a');
				newli.v=sels[i].getElementsByTagName('option')[j].value;
				newli.elm=hiddenfield;
				newli.istrigger=trigger;
				newa.href='#';
				newa.appendChild(document.createTextNode(
				sels[i].getElementsByTagName('option')[j].text));
				newli.onclick=function(){ 
					this.elm.value=this.v;
					ts_swapclass(this.istrigger,ts_triggeron,ts_triggeroff);
					ts_swapclass(this.parentNode,ts_turnintodropdown_demo2open,ts_turnintodropdown_demo2closed)
					this.istrigger.firstChild.nodeValue=this.firstChild.firstChild.nodeValue;
					return false;
				}
				newli.appendChild(newa);
				replaceUL.appendChild(newli);
			}
			ts_addclass(replaceUL,ts_turnintodropdown_demo2closed);
			var div=document.createElement('div');
			div.appendChild(replaceUL);
			ts_addclass(div,ts_boxclass);
			sels[i].parentNode.insertBefore(div,sels[i])
			toreplace[count]=sels[i];
			count++;
		}
	}
	
/*
	Turn all ULs with the class defined above into turnintodropdown_demo2 navigations
*/	

	var uls=document.getElementsByTagName('ul');
	for(var i=0;i<uls.length;i++)
	{
		if(ts_check(uls[i],ts_listclass))
		{
			var newform=document.createElement('form');
			var newselect=document.createElement('select');
			for(j=0;j<uls[i].getElementsByTagName('a').length;j++)
			{
				var newopt=document.createElement('option');
				newopt.value=uls[i].getElementsByTagName('a')[j].href;	
				newopt.appendChild(document.createTextNode(uls[i].getElementsByTagName('a')[j].innerHTML));	
				newselect.appendChild(newopt);
			}
			newselect.onchange=function()
			{
				window.location=this.options[this.selectedIndex].value;
			}
			newform.appendChild(newselect);
			uls[i].parentNode.insertBefore(newform,uls[i]);
			toreplace[count]=uls[i];
			count++;
		}
	}
	for(i=0;i<count;i++){
		toreplace[i].parentNode.removeChild(toreplace[i]);
	}
	function ts_check(o,c)
	{
	 	return new RegExp('\\b'+c+'\\b').test(o.className);
	}
	function ts_swapclass(o,c1,c2)
	{
		var cn=o.className
		o.className=!ts_check(o,c1)?cn.replace(c2,c1):cn.replace(c1,c2);
	}
	function ts_addclass(o,c)
	{
		if(!ts_check(o,c)){o.className+=o.className==''?c:' '+c;}
	}
}

window.onload=function()
{
	tamingselect();
	// add more functions if necessary
}

              
            
!
999px

Console