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 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.
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.
If the stylesheet 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 CSS 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.
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 class="container">
<section>
<p class="sans xxl narro">Der Wolf hat Kreide gefressen</p>
<p class="l">Amerikas Präsident hat gezeigt, dass er zwei Gesichter hat: Es gibt den spalterischen Trump, der bei Auftritten kein Manuskript nutzt. Der erzählt, was ihm gerade in den Sinn kommt. Der von Punkt zu Punkt hüpft, und der vor Boshaftigkeiten seinen Gegner gegenüber nicht zurückschreckt. Doch es gibt auch den zurückgenommenen Trump: Der sich an die Rede hält, die seine Mitarbeiter ihm geschrieben haben. Der brav vom Teleprompter abliest. Und der sogar präsidial wirken kann. Sein Auftritt vor den Parlamentariern des amerikanischen Kongresses zählte zur zweiten Sorte.
</p><p class="l">
Trump zeigte sich einigermaßen zahm. Den Hauptteil der eine Stunde und zwanzig Minuten langen Rede verwandte er darauf, die Errungenschaften seines ersten Amtsjahres zu preisen. Das war zu erwarten und wurde auch von seinen Vorgängern so gehandhabt. Er servierte viel Bekanntes. Die tollen Wirtschaftszahlen zelebriert er nahezu täglich auf Twitter und schreibt sich den Erfolg zu, auch wenn er zumindest in Teilen auf der Politik seines Vorgängers beruht. Aber anerkennende Wort über die Leistungen von Barack Obama werden Trump wahrscheinlich nie über die Lippen kommen.
</p><p class="l">
Der Immobilienmogul aus New York reichte in seiner Rede den Demokraten die Hand. Sein Gesetzesvorschlag für eine neue Einwanderungspolitik sieht die Einbürgerung von 1,8 Millionen Menschen vor, mehr als jeder andere Präsident je angeboten hat. Auch will er 1,4 Billionen Dollar in die marode Infrastruktur des Landes stecken. Ob die Demokraten Trumps Hand ergreifen, scheint dennoch alles andere als ausgemacht. Darauf deuten die die versteinerten Gesichter der Demokraten während Trumps Rede im Kongress hin.
</p>
<p class="m">
Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br>
In the Zoo
</p>
</section>
<section>
<p class="sans xxxl narrow">
Sixty quick brown foxes jump
</p>
<p class="sans s">
Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br>
In the Zoo<br>Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br>
In the Zoo
</p>
<p class="sans l">
Sixty quick brown foxes jump over the lazy dog<br>
In the Zoo
</p>
<p class="sans xl">
Sixty quick brown foxes
</p>
<p class="sans xxl">
Sixty quick brown foxes
</p>
</section>
</div>
/* 1.414 rythm for "Georgia": 10px / 1.52 */
@import url('https://fonts.googleapis.com/css?family=Maven+Pro:400,500');
:root {
--_lineHeight: 1.52;
--_gridColor: rgba(255, 0, 0, 0);
--_size: 10px;
font-size: var(--_size);
line-height: var(--_lineHeight);
box-sizing: border-box;
background: -webkit-linear-gradient(var(--_gridColor), var(--_gridColor) 1px, transparent 1px);
background: linear-gradient(var(--_gridColor), var(--_gridColor) 1px, transparent 1px);
background-size: 1px calc(1em * var(--_lineHeight));
background-position: 0px 16px;
}
body {
font-family: "Georgia", Georgia;
-webkit-font-smoothing: subpixel-antialiased;
-webkit-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
-ms-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
-o-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
text-rendering: optimizeLegibility;
}
@supports (font-variant-ligatures: common-ligatures) {
body {
font-feature-settings: normal;
font-variant-ligatures: common-ligatures;
}
}
/*
RESET THE BROWSER STYLES,
only necessary here
*/
*, *:before, *:after { box-sizing: inherit; }
body, div, section, p, h1, h2, h3, h4, h5 {
margin: 0; padding: 0;
}
.container {
padding-left: 4vw;
display: grid;
grid-gap: 4vw;
grid-template-columns: 1fr 1fr;
}
.header {
font-variant-numeric: lining-nums;
}
.running {
font-variant-numeric: oldstyle-nums;
}
.tabular {
font-variant-numeric: tabular-nums;
}
/* 10px */
.s {
--size: 1;
--lineHeight: 1.52;
--marginBottom: 1em;
}
/* 14px */
.m {
--size: 1.4;
--lineHeight: 1.0857142857142859;
--marginBottom: 0.8em;
}
/* 20px */
.l {
--size: 2;
--lineHeight: 1.52;
--marginBottom: 1.08em;
}
/* 28px */
.xl {
--size: 2.8;
--lineHeight: 1.0857142857142859;
--marginBottom: 0.88em;
}
/* 40px */
.xxl {
--size: 4;
--lineHeight: 1.14;
--marginBottom: 0.9em;
}
/* 57px */
.xxxl {
--size: 5.7;
--lineHeight: 1.0666666666666667;
--marginBottom: 0.8929824561403509em;
}
.sans {
--size: 1.1;
font-family: Maven Pro, Sans-Serif;
/* sans has base 11px, normalize line height : */
line-height: calc(var(--_lineHeight) / var(--size));
}
/* 11px */
.sans.s {
--size: 1.1;
--lineHeight: 1.38182;
--marginBottom: 1.04em;
}
/* 16px */
.sans.m {
--size: 1.6;
--lineHeight: 1.9000025;
--marginBottom: 1.3em;
}
/* 22px */
.sans.l {
--size: 2.2;
--lineHeight: 1.38182;
--marginBottom: 1.0545463636363637em;
}
/* 31px */
.sans.xl {
--size: 3.1;
--lineHeight: 1.4709696774193548;
--marginBottom: 1.0903235483870968em;
}
/* 44px */
.sans.xxl {
--size: 4.4;
--lineHeight: 1.036365;
--marginBottom: 0.8590915909090908em;
}
/* 62px */
.sans.xxxl {
--size: 6.2;
--lineHeight: 1.22;
--marginBottom: .96em;
}
.s, .m, .l, .xl, .xxl, .xxxl {
font-size: calc(1rem * var(--size));
margin-bottom: var(--marginBottom);
line-height: var(--lineHeight);
padding-top: calc((1em * var(--lineHeight)) - var(--marginBottom));
}
/* minimal bottom gap */
.s.narrow, .m.narrow, .l.narrow {
margin-bottom: calc(var(--marginBottom) - (1rem * var(--_lineHeight)));
}
.xl.narrow, .xxl.narrow {
margin-bottom: calc(var(--marginBottom) - (2rem * var(--_lineHeight)));
}
.xxxl.narrow {
margin-bottom: calc(var(--marginBottom) - (3rem * var(--_lineHeight)));
}
Also see: Tab Triggers