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.
<p class="intro">
What CSS property do you use to set the colour of a text block? If you said <em>color</em> you were … wrong!
</p>
<p class="intro">
Don’t take it too hard, though. It was a trick question. In typographic parlance, “color” refers to the visual density of a block of text. Here's a little sandbox where you can play with some of the properties that impact typographic color.
</p>
<h1>Font Weight</h1>
<div class="wrapper">
<div class="font-weight small">
<h2>Light</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="font-weight medium">
<h2>Normal</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="font-weight large">
<h2>Heavy</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
</div>
<h1>Tracking</h1>
<div class="wrapper">
<div class="letter-spacing small">
<h2>Tight</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="letter-spacing medium">
<h2>Normal</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="letter-spacing large">
<h2>Wide</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
</div>
<h1>Word Spacing</h1>
<div class="wrapper">
<div class="word-spacing small">
<h2>Tight</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="word-spacing medium">
<h2>Normal</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="word-spacing large">
<h2>Wide</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
</div>
<h1>Ledding</h1>
<div class="wrapper">
<div class="line-height small">
<h2>Tight</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="line-height medium">
<h2>Normal</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="line-height large">
<h2>Double</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
</div>
<h1>Justification</h1>
<div class="wrapper">
<div class="left">
<h2>Ragged Right</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="justified">
<h2>Justified</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
<div class="justified-hyphen">
<h2>Justified with Hyphenation</h2>
<p>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled <span>`ORANGE MARMALADE'</span>, but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.
</p>
</div>
</div>
/*Let's play!*/
/*Font-weight*/
.font-weight.small {
font-weight: 300;
}
.font-weight.medium {
font-weight: 400;
}
.font-weight.large {
font-weight: 600;
}
/*Letter-spacing*/
.letter-spacing.small,
.letter-spacing.small span {
letter-spacing: -0.05em;
}
.letter-spacing.medium,
.letter-spacing.medium span {
letter-spacing: 0;
}
.letter-spacing.large,
.letter-spacing.large span {
letter-spacing: 0.3em;
}
/*Word-spacing*/
.word-spacing.small {
word-spacing: -0.2em;
}
.word-spacing.medium {
word-spacing: 0em;
}
.word-spacing.large {
word-spacing: 0.5em;
}
/*Line-height */
.line-height.small {
line-height: 0.9;
}
.line-height.medium {
line-height: 1.3;
}
.line-height.large {
line-height: 2;
}
/* Justification */
.left {
text-align: left;
}
.justified {
text-align: justify;
}
.justified-hyphen {
text-align: justify;
hyphens: auto;
}
/*BONUS - play with letter-spacing on the all-caps ORANGE MARMALADE*/
span {
letter-spacing: 0.025em;
}
/*Styles*/
* {
box-model: border-box;
}
body {
font-size: 16px;
font-family: 'Cormorant Garamond', serif;
line-height: 1.3;
font-weight: 400;
letter-spacing: 0;
}
.wrapper {
width: 1080px;
border-top: 2px solid #efefef;
display: block;
margin: 0 auto;
}
.wrapper:after {
content: "";
display: table;
clear: both;
}
.wrapper div {
width: 300px;
padding-right: 60px;
padding-top: 30px;
padding-bottom: 100px;
float: left;
}
h1 {
display: block;
width: 1080px;
margin: 0 auto;
padding: 15px;
text-transform: uppercase;
letter-spacing: 0.025em;
font-variant-ligatures: none;
font-weight: 700;
font-size: 32px;
}
h2 {
display: block;
padding-bottom: 15px;
text-transform: uppercase;
letter-spacing: 0.05em;
font-variant-ligatures: none;
font-weight: 700;
font-size: 16px;
margin: 0;
}
p {
padding: 0;
margin: 0;
}
p.intro {
max-width: 1080px;
margin: 0 auto;
padding-bottom: 12px;
font-size: 24px;
}
p.intro:first-of-type {
padding-top: 100px;
}
p.intro:last-of-type {
padding-bottom: 100px;
}
@media screen and (max-width: 1100px) {
.intro,
h1,
.wrapper {
width: 600px;
padding-bottom: 50px;
}
.intro:last-of-type,
.wrapper div,
h1{
padding-bottom: 15px;
}
.wrapper div {
display: block;
float: none;
width: 100%;
margin: 0 auto;
}
}
@media screen and (max-width: 680px) {
body {
padding: 35px;
}
.intro,
h1,
.wrapper {
width: 100%;
}
h1 {
padding: 10px 0;
}
}
Also see: Tab Triggers