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.
<br>Variablen hier editieren, um sofortige Auswirkung zu sehen:
<style style="display: block;" contenteditable>
:root {
--general: "Fira Sans", "UnitRoundedOT", "SF Pro Display", "OpenDyslexic", "SF Pro Rounded", "SF Pro Text", "Segoe UI", "Calibri", "New York Small", "Noto Sans", "Work Sans", "Rubik", Helvetica, Arial, sans-serif;
--button-font-weight: 400;
--font-smooth: auto;
--link-weight: 500;
}
</style>
<div class="flex">
<article class="box">
<div class="container nobreak">
<span class="codepen-naming">Text sizes</span>
<span class="codepen-naming">Size 100: <span class="calcnumber js-size-100">#</span></span>
<span class="headline font-100">Siebte Größe</span>
<span class="codepen-naming">Size 90: <span class="calcnumber js-size-90">#</span></span>
<span class="headline font-90">Sechste Größe</span>
<span class="codepen-naming">Size 80: <span class="calcnumber js-size-80">#</span></span>
<span class="headline font-80">Fünfte Größe</span>
<span class="codepen-naming">Size 70: <span class="calcnumber js-size-70">#</span></span>
<span class="headline font-70">Vierte Größe</span>
<span class="codepen-naming">size 60: <span class="calcnumber js-size-60">#</span></span>
<span class="copy font-60">Dritte Größe</span>
<span class="codepen-naming">size 50: <span class="calcnumber js-size-50">#</span></span>
<span class="copy font-50">Zweite Größe</span>
<span class="codepen-naming">size 40: <span class="calcnumber js-size-40">#</span></span>
<span class="copy font-40">Default Browser Größe</span>
<span class="codepen-naming">size 30: <span class="calcnumber js-size-30">#</span></span>
<span class="copy font-30">Erste kleinere Skalierung</span>
<span class="codepen-naming">size 20: <span class="calcnumber js-size-20">#</span></span>
<span class="copy font-20">Zweite kleinere Skalierung</span>
<span class="codepen-naming">size 10: <span class="calcnumber js-size-10">#</span></span>
<span class="copy font-10">Dritte kleinere Skalierung</span>
</div>
</article>
<article class="box">
<div class="container preview">
<span class="codepen-naming">Context preview</span>
<span class="mb headline font-100">Willkommen bei REWE</span>
<span class="mb copy font-60">Jetzt beim REWE Liefer- und Paketservice bestellen und Einkäufe liefern lassen.</span>
<span class="mb section-intro font-50">Ihre Zusammenfassung</span>
<a href="#" class="mb copy link font-40">Wein,Spirituosen & Tabak</a>
<span class="mb copy font-40"><strong>King Cuisine Hummus 175g</strong></span>
<span class="mb copy font-40">When text is rendered by a computer,
sometimes there will be characters in the text that can not be displayed,
because no font that supports them is available to the computer. When this occurs,
small boxes are shown to represent the characters. <strong>Dieser Text ist Fließtext in Medium.</strong>We call
those small boxes “tofu,
” and we want to remove tofu from the Web. This is how the Noto font families got their name. Noto helps to make
the web more beautiful across platforms for all languages. Currently, Noto covers over 30 scripts, and will cover
all of Unicode in the future. <a href="#" class="link">Textlink mitten im Fließtext</a>. This is the Sans Latin, Greek and
Cyrillic family. It has Regular, Bold, Italic and Bold Italic styles and is hinted. It is derived from Droid, and
like Droid it has a serif sister family, Noto Serif. 175g (100 g=0, 91 €)</span>
<span class="mb footnote font-20">inkl. gesetzl. MwSt, zzgl. <a href="#" class="link">Versandkosten</a></span>
<br>
<button class="button button-secondary-style-1">Weiter einkaufen </button> <button class="button button-primary button-primary-style-1">Zur Kasse</button>
</article>
<article class="box">
<div class="container nobreak">
<span class="codepen-naming">Interaction elements, Style 2</span>
<br>
<br>
<button class="button button-primary-style-2">Button Primary</button>
<br>
<br>
<button class="button button-secondary-style-2">Button Secondary</button>
<br>
<br>
<button class="button button-secondary-style-2 button-tertiary-style-2">Button tertiary</button>
<br>
<br>
<a href="#" class="link">Textlink</a>
<br>
<br>
<span class="codepen-naming">Interaction elements, style 1</span>
<br>
<br>
<button class="button button-primary button-primary-style-1">Button Primary</button>
<br>
<br>
<button class="button button-secondary-style-1">Button Secondary</button>
<br>
<br>
<button class="button button-tertiary-style-1">Button Tertiary</button>
</div>
</article>
</div>
@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,300;0,400;0,500;1,700&Rubik:wght@400;500;600&family=Work+Sans&family=Noto+Sans:wght@400;700&display=swap");
:root {
// die vorherige size wird mit step multipliziert, was dann mit der skalierung multipliziert wird.
// 16*1.02*1.045 = 17.0544
// --step: 1.1;
// --scaling-factor: 1.13;
/*--font-70: calc((var(--font-60) * var(--step)) * var(--scaling-factor));
--font-60: calc((var(--font-50) * var(--step)) * var(--scaling-factor));
--font-50: calc((var(--font-40) * var(--step)) * var(--scaling-factor));
--font-40: calc((var(--font-30) * var(--step)) * var(--scaling-factor));
--font-30: calc((var(--font-20) * var(--step)) * var(--scaling-factor));
--font-20: var(--base-font-size);
--font-10: calc(var(--base-font-size) * 0.875);*/
/* Schriftgrößen Stufen von JK
10
12
14
=16=
18
20
24
32
40
48
*/
--headline: "REWE Mato Web", Sans-Serif;
--preview: 1;
--base-font-size: 1rem;
--font-10: 0.625rem;
--font-20: 0.75rem;
--font-30: 0.875rem;
--font-40: 1rem;
--font-50: 1.125rem;
--font-60: 1.25rem;
--font-70: 1.5rem;
--font-80: 2rem;
--font-90: 2.5rem;
--font-100: 3rem;
}
* {
font-smooth: var(--font-smooth);
}
style {
white-space: pre-line;
padding: 1.2rem;
padding-top: 0;
border-radius: 4px;
margin: 1em 0;
font-family: monospace;
line-height: 1.4;
overflow: auto;
border: 1px solid gray;
background-color: #333;
color: #dedede;
max-width: max-content;
text-shadow: 0 1px 2px rgba(0, 0, 0, 1);
}
.font-100 {
font-size: var(--font-100);
}
.font-90 {
font-size: var(--font-90);
}
.font-80 {
font-size: var(--font-80);
}
.font-70 {
font-size: var(--font-70);
}
.font-60 {
font-size: var(--font-60);
}
.font-50 {
font-size: var(--font-50);
}
.font-40 {
font-size: var(--font-40);
}
.font-30 {
font-size: var(--font-30);
}
.font-20 {
font-size: var(--font-20);
}
.font-10 {
font-size: var(--font-10);
}
.mb {
display: block;
margin-bottom: 1.2rem;
}
.box {
box-shadow: 0 0 0 1px #ddd;
}
.preview-headline {
padding: 8px;
font-size: 0.75rem;
text-transform: uppercase;
white-space: nowrap;
}
.headline {
font-weight: 600;
font-family: var(--headline);
line-height: 1.15em;
}
.subline {
font-family: var(--headline);
line-height: 1.2em;
margin-bottom: 1em;
}
.section-intro,
.section-intro > *,
.copy,
.copy > *,
.footnote,
.footnote > * {
font-family: var(--general);
}
.copy {
// line-height: 1.34em;
line-height: calc(2px + 2ex + 2px);
// line-height: 2ex;
}
.scale-preview {
font-family: var(--general);
}
.link {
font-weight: var(--link-weight);
}
a:hover {
color: #cc071e;
}
a:focus-visible {
outline: 0;
box-shadow: 0 -1px 0 3px white, 0 -1px 0 5px #0080ff;
border-radius: 0.1px;
color: #1c1c1c;
}
article {
min-width: min-content;
}
.flex {
display: flex;
flex-direction: row;
flex: 1;
}
.button {
// grundwerte mit denen die schrift an die ränder stößt
// padding: 2px 0px 0px 0px;
// line-height: 0.63em;
padding: 20px 16px 18px;
line-height: 0.63em;
margin: 0;
font-family: var(--general);
border: 0;
border-radius: 8px;
cursor: pointer;
font-weight: var(--button-font-weight);
font-size: var(--font-40);
transition: all 100ms ease;
}
.button-primary {
background-color: #cc071e;
color: #fff;
}
.button-primary-style-1:hover {
background-color: #9e0012;
}
.button-primary-style-1:active {
background-color: #9e0012;
}
.button-primary-style-1:focus-visible,
.button-secondary-style-1:focus-visible,
.button-tertiary-style-1:focus-visible {
outline: 0;
box-shadow: 0 0 0 2px white, 0 0 0 5px #0080ff;
}
.button-secondary-style-1 {
background-color: #1c1c1c;
color: white;
}
.button-secondary-style-1:hover {
background-color: #676767;
}
.button-tertiary-style-1 {
background-color: #fff;
color: #1c1c1c;
box-shadow: inset 0 0 0 2px #1c1c1c;
}
.button-tertiary-style-1:hover {
background-color: #ccc;
}
.button-tertiary-style-1:focus-visible {
box-shadow: inset 0 0 0 2px #676767, 0 0 0 2px white, 0 0 0 5px #0080ff;
}
.button-primary-style-2 {
background-color: #cc071e;
color: white;
padding: 18px 16px 16px;
border-radius: 3px;
transition: all 100ms ease;
box-shadow: inset 0 -2px 0 0 rgba(0, 0, 0, 0.19),
0 1px 8px 0 rgba(0, 0, 0, 0.19), 0 1px 1px 0 rgba(0, 0, 0, 0.19);
}
.button-primary-style-2:focus-visible {
outline: none;
transition: all 100ms ease;
box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0), 0 0 0 0 rgba(0, 0, 0, 0),
0 0 0 0 rgba(0, 0, 0, 0), inset 0 0 0 2px #cc017e, inset 0 0 0 4px #f9e6e8;
}
.button-primary-style-2:hover {
box-shadow: inset 0 -2px 0 0 rgba(0, 0, 0, 0.19),
0 1px 8px 0 rgba(0, 0, 0, 0.19), 0 1px 1px 0 rgba(0, 0, 0, 0.19),
0 0 0 2px #cc071e, inset 0 0 0 1px #cc071e;
}
.button-primary-style-2:active {
background-color: #9e0012;
box-shadow: inset 0 -2px 0 0 rgba(0, 0, 0, 0.19),
0 1px 8px 0 rgba(0, 0, 0, 0.19), 0 1px 1px 0 rgba(0, 0, 0, 0.19),
0 0 0 2px #9e0012, inset 0 0 0 1px #9e0012;
}
.button-secondary-style-2 {
padding: 18px 16px 16px;
border-radius: 3px;
transition: all 100ms ease;
background-color: white;
color: #1c1c1c;
box-shadow: inset 0 0 0 1px #949494, inset 0 -3px 0 0 rgba(0, 0, 0, 0.19),
0 1px 8px 0 rgba(0, 0, 0, 0.19), 0 1px 1px 0 rgba(0, 0, 0, 0.19);
}
.button-secondary-style-2:focus-visible {
outline: none;
box-shadow: inset 0 0 0 1px #949494, inset 0 0 0 2px white,
inset 0 0 0 4px #0080ff;
}
.button-secondary-style-2:hover {
box-shadow: inset 0 -3px 0 0 rgba(0, 0, 0, 0.19), 0 0 0 2px #676767;
}
.button-secondary-style-2:active {
background-color: #1c1c1c;
color: white;
}
.button-tertiary-style-2 {
padding: 12px 16px 12px;
}
.button-size-10 {
font-size: var(--font-10);
padding: var(--font-10);
}
.button-size-20 {
font-size: var(--font-20);
padding: var(--font-20);
}
.button-size-30 {
font-size: var(--font-30);
padding: var(--font-30);
}
.button-size-40 {
font-size: var(--font-40);
padding: var(--font-40);
}
.button-size-50 {
font-size: var(--font-50);
padding: var(--font-50);
}
// ----------------------------------------
* {
color: #4a4a4a;
font-family: Sans-serif;
}
span {
display: block;
font-family: var(--typeface);
}
strong {
font-weight: 500;
}
.container {
padding: 40px;
}
.codepen-naming {
color: slategray;
margin-top: 20px;
font-size: 0.8rem;
letter-spacing: 0.04rem;
text-transform: uppercase;
font-weight: 600;
margin-bottom: 0.2rem;
}
.calcnumber {
color: slategray;
display: inline-block;
}
.nobreak {
white-space: nowrap;
}
.preview {
opacity: var(--preview);
}
setInterval(function () {
const text100 = document.querySelector(".js-size-100");
const style100 = getComputedStyle(document.querySelector(".font-100"));
text100.innerHTML = style100.fontSize;
const text90 = document.querySelector(".js-size-90");
const style90 = getComputedStyle(document.querySelector(".font-90"));
text90.innerHTML = style90.fontSize;
const text80 = document.querySelector(".js-size-80");
const style80 = getComputedStyle(document.querySelector(".font-80"));
text80.innerHTML = style80.fontSize;
const text70 = document.querySelector(".js-size-70");
const style70 = getComputedStyle(document.querySelector(".font-70"));
text70.innerHTML = style70.fontSize;
const text60 = document.querySelector(".js-size-60");
const style60 = getComputedStyle(document.querySelector(".font-60"));
text60.innerHTML = style60.fontSize;
const text50 = document.querySelector(".js-size-50");
const style50 = getComputedStyle(document.querySelector(".font-50"));
text50.innerHTML = style50.fontSize;
const text40 = document.querySelector(".js-size-40");
const style40 = getComputedStyle(document.querySelector(".font-40"));
text40.innerHTML = style40.fontSize;
const text30 = document.querySelector(".js-size-30");
const style30 = getComputedStyle(document.querySelector(".font-30"));
text30.innerHTML = style30.fontSize;
const text20 = document.querySelector(".js-size-20");
const style20 = getComputedStyle(document.querySelector(".font-20"));
text20.innerHTML = style20.fontSize;
const text10 = document.querySelector(".js-size-10");
const style10 = getComputedStyle(document.querySelector(".font-10"));
text10.innerHTML = style10.fontSize;
}, 300);
Also see: Tab Triggers