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.
%meta{content: "width=device-width, initial-scale=1.0, maximum-scale=1, minimal-ui", name: "viewport"}
%span
%article
%h2 Craft and Beauty
%h4 The Shape of Design • Chapter Two
%p They say all things began as nothing. I should believe this, but it is difficult to conceive of nothing in the middle of a world that is so full. I close my eyes and try to picture a darkness, but even that is something. We are told that there was a big bang at the beginning of time that created the universe, but this turns creation into a spectacle. I’m skeptical of showmanship. The romantic in me wants to imagine there was no flash, no bang. Perhaps instead there was a quiet dignity to the spurring of matter from nothingness. I tell myself a story to draw back the darkness and fill the void.
%hr
%p In the beginning, a voice slowly approached from afar, so unhurried that it was hardly noticeable. “Better,” it whispered. But no bang, no fireworks. No grand gestures or swipes of God. The secret closed in and contained the void, like how a hushed, familiar voice in the dark can create a pocket of warmth around it. I picture how the loose gases firmed to make the planets. The spheres spun, and the atoms collided and combined in uncountable ways over billions of years. The cocktail thickened and congealed, and after an unimaginable number of attempts, life showed up, sprawled out, then pushed on. We gained hearts and eyes, legs and hands. We crawled out of the muck, climbed into the trees, and eventually came back down.
%p The first boom, the recipe that produced the universe and life, was born of circumstance. The second boom, one of the mind and making, was by design.
%hr
%p I hold a token of the second bang in my hands. No bang, no show – most would say what I’m holding is just a rock. Walk into any proper house of curiosities and ask to see their hand axes. They will show you something similar to what I hold: a stone resembling an arrowhead with a tip that is honed and sharp. It will be close to the size of a deck of cards and fit comfortably into the hand. Hand axes are frequently cited as the first human-made objects; the oldest specimens, discovered in Ethiopia, are estimated to be about two-and-a-half million years old. We have been molding this world for a very long time.
%p The hand axes record the first moment that we understood that the world was malleable – that things can change and move, and we can initiate those transformations ourselves. To be human is to tinker, to envision a better condition, and decide to work toward it by shaping the world around us.
%hr
%p In this way, design is a field of transformations concerned with the steps we take to mold our situations. The maker of this hand axe transformed a rock into a tool which allowed him to turn a sealed nut into a platter; it allowed him to turn beasts on the plain into dinner. The same making instinct was at play when the Wrights flew their first airplane or when Greek architects sat down to mastermind the Parthenon. The products of our endeavors sprawl out behind us in a wake of repercussions and remain, in some cases, for millions of years.
%p There is often a diligence in construction to these axes, an elegant symmetry to their form. These details don’t necessarily contribute to the utility of the tool, but their presence implies that we’ve cared about craft ever since our minds first opened up to the idea of invention. A polished axe does not chop better, just as the refined design of a lamp does not necessarily light a room more fully. Beauty is a special form of craft that goes beyond making something work better.
@import "bourbon";
@import url(https://fonts.googleapis.com/css?family=Merriweather:400,700,400italic);
/* Try setting this to true :) */
$dark: false;
$bg: #fff;
$pink: #F84BA2;
$grey: #3A4145;
$lightgrey: #ddd;
@if $dark {
$bg: #31373a;
$pink: #4ba2f8;
$grey: #eee;
$lightgrey: #888;
}
html {
font-size: 70%;
}
body {
height: 100%;
max-height: 100%;
font-family: Merriweather, Georgia, serif;
font-size: 1.8rem;
line-height: 1.8em;
color: $grey;
background: $bg;
width: 100%;
opacity: 0;
@include animation(in .8s ease 1s forwards);
}
span {
content: '';
height: 5px;
position: fixed;
left: 0;
width: 0%;
background: $pink;
}
::selection {
color: #fff;
background: $pink;
text-shadow: none;
}
p {
margin: 1.6em 0;
}
hr {
margin: 2em 0;
text-align: center;
line-height: 1px;
height: 1px;
background: $lightgrey;
border: 15px solid $bg;
border-left: 0;
border-right: 0;
font-size: 1.5em;
&:after {
content: attr(txt);
color: $lightgrey;
display: inline;
background: $bg;
padding: .2em .5em;
border: 1px solid $bg;
border-radius: 100px;
transition: .3s ease all;
}
&:before {
position: absolute;
content: '';
background: transparent;
border-spacing: 10px;
margin-top: -24px;
@include transform( scale(.5));
margin-left: 1px;
width: 49px;
height: 49px;
transition: .3s ease-out all;
border-radius: 100px;
}
&:not(.heart):hover {
&:after {
border: 1px solid $lightgrey;
}
&:before{
@include transform(scale(1));
background: $lightgrey;
transition: 3s cubic-bezier(.5,-0.74,.79,1.53) all;
@include animation(out .3s cubic-bezier(.5,-0.74,.79,1.53) 3.2s forwards);
}
}
&.heart:after {
color: $pink;
padding: .2em .4em;
}
}
article {
p:first-of-type:first-letter {
float: left;
font-size: 5.7rem;
line-height: 6.5rem;
margin: 0 10px 0 0;
}
p:not(:first-of-type) {
text-indent: 1.4em;
}
margin: 0 auto;
max-width: 700px;
padding: 40px 11.14%;
word-break: break-word;
hyphens: auto;
}
h4 {
color: $lightgrey;
font-size: .8em;
letter-spacing: .51px;
text-align: center;
margin: -1.7em auto 3em;
font-style: italic;
}
h2 {
font-size: 7.4rem;
font-weight: 600;
text-align: center;
font-size: 4.2rem;
line-height: 10rem;
}
@media only screen and (max-width: 700px) {
article {
p:first-of-type:first-letter {
font-size: 4.6rem;
line-height: 5.2rem;
margin: 0 10px 0 0;
}
font-size: .85em;
line-height: 1.7em;
margin-bottom: 30px;
padding: 8%;
}
h2 {
font-size: 3.5rem;
line-height: 3.5em;
letter-spacing: 0;
}
h4 {
letter-spacing: .3px;
margin: -2.7em auto 4em;
}
}
@media only screen and (max-width: 502px) {
article {
width: auto;
font-size: .8em;
line-height: 1.6em;
p:first-of-type:first-letter {
font-size: 4rem;
line-height: 4.5rem;
margin: 0 6px 0 0;
}
}
h2 {
font-size: 2.4rem;
line-height: 1.4em;
letter-spacing: 0;
}
h4 {
letter-spacing: 0;
margin: .4em auto 3em;
}
}
@include keyframes(in) {
0% { opacity: 0 }
100% { opacity: 1 }
}
@include keyframes(out) {
0% { opacity: 1 }
100% { opacity: 0 }
}
heart = undefined
$ ->
docHeight = undefined
final = undefined
lastScroll = undefined
windowHeight = undefined
$("hr").attr "txt", "§"
lastScroll = undefined
docHeight = undefined
windowHeight = undefined
final = undefined
$(window).scroll ->
lastScroll = window.scrollY
windowHeight = $(window).height()
docHeight = $(document).height()
final = ((lastScroll + (windowHeight * Math.pow((lastScroll + windowHeight) / docHeight, 10))) / docHeight) * 100
$("span").css width: final + "%"
return
return
heart = ->
$("hr").addClass "heart"
$("hr").attr "txt", "♥"
return
$("hr").hoverIntent
over: heart,
interval: 1450,
out: heart
Also see: Tab Triggers