HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="menF">
<select id="">
<option value="hide">Par Genre</option>
<option value="2010">Action</option>
<option value="2011">Amour</option>
<option value="2013">Animation</option>
<option value="2012">Arts Martiaux</option>
<option value="2014">Aventure</option>
<option value="2015">Comédie</option>
<option value="2015">Divers</option>
<option value="2015">Documentaire</option>
<option value="2015">Drâme</option>
<option value="2015">Érotique</option>
<option value="2015">Famille</option>
<option value="2015">Fantastique</option>
<option value="2015">Guerre</option>
<option value="2015">Historique</option>
<option value="2015">Horreur</option>
<option value="2015">Policier</option>
<option value="2015">Science Fiction</option>
<option value="2015">Sport</option>
<option value="2015">Triller</option>
<option value="2015">Western</option>
</select>
<select id="year">
<option value="hide">Par Année</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
</select>
<select id="">
<option value="hide">Par Nationalité</option>
<option value="2010">Allemand</option>
<option value="2011">Américain</option>
<option value="2011">Australien</option>
<option value="2011">Belge</option>
<option value="2012">Britannique</option>
<option value="2013">Canadien</option>
<option value="2013">Danois</option>
<option value="2011">Espagnol</option>
<option value="2014">Français</option>
<option value="2015">Indien</option>
<option value="2015">Irlandais</option>
<option value="2015">Islandais</option>
<option value="2011">Italien</option>
<option value="2015">Japonais</option>
<option value="2015">Méxicain</option>
<option value="2011">Russe</option>
<option value="2011">Sud-Africain</option>
<option value="2011">Sud-Coréen</option>
<option value="2011">Suédois</option>
<option value="2015">Suisse</option>
</select>
<select>
<option>Derniers ajouts</option>
<option value="2011">Date de sortie</option>
<option value="2012">Popularité</option>
<option value="2013">Note</option>
<option value="2014">Budget</option>
</select>
</div>
/* Initialisation */
html,body{
display:block;
width:100%;
height:100%;
-webkit-box-sizing:border-box;
box-sizing:border-box;
font-family:"Quicksand","Open Sans",sans-serif;
}
html{ background:url(//vincentrocher.fr/codepen/images/backgrounds/blur-1.jpg) no-repeat;
background-size:cover;
}
#menF{
width:100%;
background: rgba(50, 50, 50, 0.8);
position:fixed;
top:0px;
left:0;
z-index:5;
box-shadow: 0 0 15px -2px #141414;
text-align:center;
font-family:"Quicksand","Open Sans",sans-serif;
padding-bottom:8px;
}
.select-hidden {
display: none;
visibility: hidden;
padding-right: 10px;
}
.select {
cursor: pointer;
display: inline-block;
position: relative;
font-size: 14px;
color: #fff;
width: 170px;
height: 30px;
line-height: 31px;
text-align:left;
margin-top:10px;
}
.btnSelect {
position: absolute;
top:0;right:0;bottom:0;left:0;
background-color: rgba(20,20,20, 0.8);
padding: 0 15px;
margin:0 2px -2px 2px;
transition: all 0.2s ease-in;
box-shadow: 0 0 5px -2px rgba(20,20,20, 0.8);
}
.btnSelect:after {
content:"";
width: 0;
height: 0;
border: 7px solid transparent;
border-color: #FFF transparent transparent transparent;
position: absolute;
top: 12px;
right: 10px;
}
.btnSelect:active,
.btnSelect:hover,
.active { background-color: rgba(0,0,0, 0.8); }
.btnSelect:active,
.active:after{ top: 5px; border-color: transparent transparent #fff transparent; }
.listSelect {
display: none;
position: absolute;
top: 100%;
right: 0;
left: 0;
z-index: 999;
margin: 0;
padding: 0;
font-size: 15px;
list-style: none;
background-color: rgba(40,40,40, 0.95);
box-shadow: 0 0 15px -2px #141414;
max-height: 700px;
overflow-y: scroll;
overflow-x: hidden;
}
.listSelect li{
margin: 0;
text-indent: 15px;
border-top: 1px solid rgba(0,0,0, 0.8);
transition:all 0.2s ease-in;
}
.listSelect .listSelect, .listSelect li:hover{
background: rgba(150,150,150, 0.4);
}
$('select').each(function(){
var $this = $(this), numberOfOptions = $(this).children('option').length;
$this.addClass('select-hidden'); // On masque le select
$this.wrap('<div class="select"></div>'); // On créer une div parrent
$this.after('<div class="btnSelect"></div>'); // On ajoute le bouton
var $styledSelect = $this.next('.btnSelect'); // Var bouton
$styledSelect.text($this.children('option').eq(0).text()); // On insere le text du premier select
var $list = $('<ul />', { 'class': 'listSelect' }).insertAfter($styledSelect); // On insert la liste
for (var i = 0; i < numberOfOptions; i++) {
$('<li />', {
text: $this.children('option').eq(i).text(),
rel: $this.children('option').eq(i).val(),
class: $this.children('option').eq(i).attr('class')
}).appendTo($list);
}
var $listItems = $list.children('li');
// Au clic sur le bouton liste
$styledSelect.click(function(e) {
e.stopPropagation();
$('.btnSelect.active').not(this).each(function(){ // On ferme les listes ouvertes
$(this).removeClass('active').next('.listSelect').hide();
});
$(this).toggleClass('active').next('.listSelect').toggle(); // On active le bouton et deroule la liste
});
// Au clic sur un element de la liste
$listItems.click(function(e) {
e.stopPropagation();
$styledSelect.text($(this).text()).removeClass('active'); // On change le titre par celui cliqué
$(this).addClass('click');
$this.val($(this).attr('rel')); // On recupere la valeur de l'element
$list.hide(); // on ferme la liste
});
// Au clic en dehors de la liste
$(document).click(function() {
$styledSelect.removeClass('active');
$list.hide();
});
});
Also see: Tab Triggers