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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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.
<audio id="sound" src="http://www.tp-strudengau.at/nana.mp3"></audio>
<audio src="http://www.tp-strudengau.at/bb.mp3" id="bomb"></audio>
<img id="batman" src="https://d13yacurqjgara.cloudfront.net/users/502620/screenshots/2037285/batman_run.gif">
<img id="pow" src="https://24.media.tumblr.com/5308be6d5dd4c505c05d2b47289c0670/tumblr_mjj2sgWlTM1rhelkjo1_500.gif" alt="" />
<h1 id="winner">Stefan Baumgartner</h1>
<link href="https://fonts.googleapis.com/css?family=Bangers" rel="stylesheet">
body {
background-color: #f7f7f8;
position: relative;
min-height: 100vh;
margin: 0;
}
.hidden {
display: none !important;
}
#batman {
width: 50%;
display: block;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-200%, -50%);
transition: none;
}
.start #batman {
transform: translate(-50%, -50%);
transition: transform 6s ease;
}
#pow {
position: absolute;
top: 50%;
left: 50%;
height: 100%;
display: none;
transform: translate(-50%, -50%);
}
.end #pow {
display: block;
}
h1 {
font-family: 'Bangers';
font-size: 60px;
font-weight: normal;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
opacity: 0;
margin: 0;
}
h1.in {
transition: opacity 2s ease;
opacity: 1;
}
var running = false;
$('body').on('click', (e) => {
if(running) return;
running = true;
$('body').removeClass('end');
$('#pow').removeClass('hidden');
$('#winner').removeClass('in');
$('#sound')[0].currentTime = 0;
$('#bomb')[0].currentTime = 0;
$('#sound')[0].play();
$('#bomb')[0].pause();
$('body').addClass('start');
setTimeout(end, 9000);
});
const end = () => {
$('body').addClass('end');
$('body').removeClass('start');
$('#sound')[0].pause();
$('#bomb')[0].play();
setTimeout(removeBomb, 1000);
}
const removeBomb = () => {
$('#pow').addClass('hidden');
const idx = parseInt(Math.random() * uniques.length);
$('#winner').text(uniques[idx]);
$('#winner').addClass('in');
running = false;
uniques.splice(idx, 1);
}
const fb = ["Felix Valmont", "Willi Twyn", "Christina Stuerz", "Frederic Köberl", "Emanuel Zeilinger", "David Tanzer", "Florian Harwöck", "Stefan Starke", "Robert Kohel", "Adrian Fü", "Kai Takac", "Patrick Steiner", "Hannes Sachsenhofer", "Christian Haider", "Franz Ebner", "Michael Schober", "Daniel Bauer", "Dom Kai", "Peter Studener", "Renate Wölbitsch", "Michael Kirchmair", "Jürgen Ratzenböck", "Manuela Seethaler", "Michael Wimmer", "Isabella Bognermayr", "MMatthiass KKoglerr", "Martin Weber", "Fabian Hurnaus", "David Brunnthaler", "Gerald Hoheneder", "Elisabeth Rosemann", "Thomas Einwaller", "Daniel Dekic", "Hannes Brandstätter-Müller", "Robert Schmelzer", "Onur Sen"];
const meetup = ["Hanna", "Felix Valmont", "Onur Sen", "Matthias 'Yolgie' Holzinger", "Sebastian Gierlinger", "Thomas L", "Rene Pirringer", "Elmar Putz", "Christoph Zauner", "Joachim Zenkel", "Robert Baumgartner", "Thomas Pichler", "Rene Reiter", "Stefan Baumgartner", "Thomas Einwaller", "Thomas Scheinecker", "chris.net", "Clem Niem", "Martin Jobst", "Gergely Kalapos", "Christian Haider", "Charlie Frauscher", "Mario Rader", "Joachim", "Florian Harwöck", "Johannes Strassmayr", "Johannes Krenn", "Wolfgang Hafenscher", "Rudolf Kussberger", "Herbert Teibler", "Hannes Brandstätter-Müller", "Michael Weichselbaumer", "Andi", "Nikolaus Weingartmair", "Christoph F", "Frederic Köberl", "Christopher Bradley", "Iva", "Martin Niederl", "Peter Stritzinger", "Andreas Altendorfer", "Thomas Kent Rohrberg", "Martin Weber", "Thomas Fischl", "Aleksandar Djurdjic", "Josef Altmann", "Manuel Moser", "Andreas Frühwirt", "Patrick Steiner", "Harald Seltner", "Hal Ko", "Karl Artmann", "bullshit", "Elisabeth Rosemann", "Alexander Rosemann", "Dominik Hurnaus", "Hannes Sachsenhofer", "Doris Tiefenthaler", "Mia Baumgartner", "Clemens Tiefenthaler"];
const members = meetup.concat(fb);
const uniques = Array.from(new Set(members));
console.log(uniques);
console.log(uniques.length);
Also see: Tab Triggers