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.
<label for="english" class="btn">English</label>
<input type="radio" name="lang" id="english">
<label for="german" class="btn">Deutsch</label>
<input type="radio" name="lang" id="german" checked>
<div class="wrapper">
<div class="english animated fadeInDown">
<p>Far far away, behind the word mountains, far from the countries Vowelia and Consonantia reside the dummy texts. Apart from society they live in Bookmarksgrove right at the coast of the Semantics, which is a large language ocean. A samm river named Dictionary flows by their place and supplies them with the necessary policments. It is a paradisemantic country, in which roasted sentence fragments fly directly in your mouth. Even the all-mighty punctuation can govern them, it's an almost unorthographic life.</p>
<p>But one day a small line of dummy text called Lorem Ipsum decided to leave off and dive into the World of Grammar.</p>
<p>The big Oxmox advised it not to do so, warning it about bad Commas, wild Question Marks and devious Semicolons but Lorem Ipsum refused to listen. It packed and left Bookmarksgrove for good.</p>
<p>When it reached the first hills of the Oblique Mountains it took a last look back at the skyline of its hometown, the headline of Alphabet Town and the subline of its own street, the line lane. A sad rhetorical question ran over its cheek, then it picked up its way.</p>
<p>On her travels it met a copy. The copy warned little Lorem Ipsum. Where it came from it had been rewritten a thousand times and everything left from its origin would be the word "and" and the little dummy text should turn round and return to its own safe country. But nothing the Copy said could convince it and so it didn't take long until a few insidious Designers ambushed it, made it drunk and dragged it into their agency, where they abused it for their projects again and again.</p>
<p>And if it hasn't been rewritten, then they are still using it.</p>
</div>
<div class="german animated fadeInDown">
<p>Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben.</p>
<p>Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik.</p>
<p>Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.</p>
<p>Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort.</p>
<p>Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort "und" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten.</p>
<p>Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.</p>
</div>
</div>
/* Basic Style */
body{
background: #ccc;
text-align: center;
font-family: Calibri;
}
.btn,
.btn:visited {
color: #fff;
background: #005899;
box-shadow: 0px 3px 0px 0px #01192e;
padding: 8px 22px;
font-size: 18px;
line-height: 100%;
text-shadow: 0 1px rgba(0, 0, 0, 0.4);
color: #fff;
display:inline-block;
vertical-align: middle;
text-align: center;
cursor: pointer;
font-weight: 300;
transition: background 0.1s ease-in-out;
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
-ms-transition: background 0.1s ease-in-out;
-o-transition: background 0.1s ease-in-out;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
color: #fff;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.btn:hover,
.btn:visited:hover,
.btn:focus,
.btn:visited:focus {
background: #00467b;
}
.btn:active,
.btn:visited:active {
box-shadow: 0px 1px 0px 0px #01192e;
}
.wrapper {
width: 90%;
margin: 0px auto;
background: #fff;
padding: 10px;
text-align: justify;
display: block;
}
.wrapper div{
display: none;
}
/* Checkbox Hack */
input[type=radio] {
opacity: 0;
}
label {
display: inline-block;
margin: 60px 0 10px 0;
cursor: pointer;
}
/* Default State */
/* Toggled State */
#english:checked ~ .wrapper .english{
display: block;
-webkit-animation-duration: .5s;
-o-animation-duration: .5s;
-moz-animation-duration: .5s;
animation-duration: .5s;
}
#english ~ .wrapper .english{
display: none;
}
#english:checked ~ .wrapper .german{
display: none;
}
#german ~ .wrapper .german{
display: none;
}
#german:checked ~ .wrapper .english{
display: none;
}
#german:checked ~ .wrapper .german{
display: block;
-webkit-animation-duration: 1s;
-o-animation-duration: 1s;
-moz-animation-duration: 1s;
animation-duration: 1s;
}
Also see: Tab Triggers