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.
<main>
<section class="intro">
<h1>CSS Section Breaks</h1>
</section>
<section class="sb-index text-measure">
<div class="sb sb-1">
<small>section break 1</small>
<hr class="section-break-1" />
</div>
<div class="sb sb-2">
<small>section break 2</small>
<hr class="section-break-2" />
</div>
<div class="sb sb-3">
<small>section break 3</small>
<hr class="section-break-3" />
</div>
<div class="sb sb-4">
<small>section break 4</small>
<hr class="section-break-4" />
</div>
<div class="sb sb-5">
<small>section break 5</small>
<hr class="section-break-5" />
</div>
</section>
<section class="text-measure">
<h1>
A sudden commotion among the goats brought the boys to their feet.
</h1>
<p>
I was alone in my big house. As I have told you often before, in those days we could talk with one another over wires or through the air. The telephone bell rang, and I found my brother talking to me. He told me that he was not coming home for fear of catching the plague from me, and that he had taken our two sisters to stop at Professor Bacon's home. He advised me to remain where I was, and wait to find out whether or not I had caught the plague.
</p>
<hr class="section-break-1">
<p>
To all of this I agreed, staying in my house and for the first time in my life attempting to cook. And the plague did not come out on me. By means of the telephone I could talk with whomsoever I pleased and get the news. Also, there were the newspapers, and I ordered all of them to be thrown up to my door so that I could know what was happening with the rest of the world.
</p>
<hr class="section-break-2" />
<p>
New York City and Chicago were in chaos. And what happened with them was happening in all the large cities. A third of the New York police were dead. Their chief was also dead, likewise the mayor. All law and order had ceased. The bodies were lying in the streets un-buried. All railroads and vessels carrying food and such things into the great city had ceased runnings and mobs of the hungry poor were pillaging the stores and warehouses. Murder and robbery and drunkenness were everywhere. Already the people had fled from the city by millions—at first the rich, in their private motor-cars and dirigibles, and then the great mass of the population, on foot, carrying the plague with them, themselves starving and pillaging the farmers and all the towns and villages on the way.
</p>
<hr class="section-break-3" />
<p>
Now this is the strange thing about these germs. There were always new ones coming to live in men's bodies. Long and long and long ago, when there were only a few men in the world, there were few diseases. But as men increased and lived closely together in great cities and civilizations, new diseases arose, new kinds of germs entered their bodies. Thus were countless millions and billions of human beings killed. And the more thickly men packed together, the more terrible were the new diseases that came to be. Long before my time, in the middle ages, there was the Black Plague that swept across Europe. It swept across Europe many times. There was tuberculosis, that entered into men wherever they were thickly packed. A hundred years before my time there was the bubonic plague. And in Africa was the sleeping sickness. The bacteriologists fought all these sicknesses and destroyed them, just as you boys fight the wolves away from your goats, or squash the mosquitoes that light on you. The bacteriologists—
</p>
<hr class="section-break-4" />
<p>
You, Edwin, are a goatherd. Your task is to watch the goats. You know a great deal about goats. A bacteriologist watches germs. That's his task, and he knows a great deal about them. So, as I was saying, the bacteriologists fought with the germs and destroyed them—sometimes. There was leprosy, a horrible disease. A hundred years before I was born, the bacteriologists discovered the germ of leprosy. They knew all about it. They made pictures of it. I have seen those pictures. But they never found a way to kill it. But in 1984, there was the Pantoblast Plague, a disease that broke out in a country called Brazil and that killed millions of people. But the bacteriologists found it out, and found the way to kill it, so that the Pantoblast Plague went no farther. They made what they called a serum, which they put into a man's body and which killed the pantoblast germs without killing the man. And in 1910, there was Pellagra, and also the hookworm. These were easily killed by the bacteriologists. But in 1947 there arose a new disease that had never been seen before. It got into the bodies of babies of only ten months old or less, and it made them unable to move their hands and feet, or to eat, or anything; and the bacteriologists were eleven years in discovering how to kill that particular germ and save the babies.
</p>
<hr class="section-break-5" />
</section>
<section class="colophon">
<dl>
<dt>Typeface:</dt>
<dd>Open Sans via <a href="http://brick.im/fonts/opensans/" target="_blank">Brick</a>.</dd>
<dt>Copy:</dt>
<dd>The Scarlet Plague, by Jack London via <a href="http://www.fillerati.com/" target="_blank">fillerati</a>.</dd>
</dl>
</section>
</main>
$body-color: slategray;
$body-text-size: 1.6rem;
$break-color: rgb(200, 200, 200);
$page-color: snow;
$shadow-color: rgba(0, 0, 0, .15);
$outline-color: rgba(0, 0, 0, .1);
$text-color: lighten(black, 30%);
html {
font-size: 62.5%;
}
body {
background: $body-color;
font-family: 'Open Sans', Helvetica, "Lucida Grande", sans-serif;
font-weight: 400;
padding: 2.5rem 0 10rem;
text-rendering: geometricPrecision;
margin: 0 1px;
}
p {
font-size: $body-text-size;
line-height: 1.7;
}
h1 {
font-size: 2.4rem;
}
main {
background: $page-color;
color: $text-color;
margin: 0 auto 2px;
outline: 1px solid $outline-color;
padding: .5rem 3rem 3rem;
position: relative;
max-width: 50vw;
z-index: 1;
box-shadow: 0 0 10rem rgba(0, 0, 0, .3);
}
.intro {
h1 {
margin: 0;
}
}
.sb-index,
.intro,
.colophon {
border-bottom: 1px solid $outline-color;
overflow: auto;
width: 100%;
margin: 0 -3rem;
padding: 3rem;
}
.sb {
float: left;
margin-bottom: .5rem;
position: relative;
width: 100%;
small {
background: $body-color;
color: white;
border-radius: .5rem;
box-shadow: 0 .1rem .1rem 0 $shadow-color;
font-size: 1.2rem;
left: 50%;
opacity: 0;
padding: 1rem;
position: absolute;
transform: translate(-50%, 0);
transition:
opacity 1s ease-out,
transform .5s cubic-bezier(0.175, 0.885, 0.320, 1.275);
z-index: 5;
}
&:hover {
cursor: help;
> small {
opacity: 1;
transform: translate(-50%, -75%);
}
}
}
/* Section Break 1 */
.section-break-1 {
background-color: transparent;
border: 0;
border-top: 3px double $break-color;
height: 3px;
margin: 2rem auto;
width: 30%;
&:before {
background-color: $page-color;
color: $break-color;
content: '\22A1';
font-size: 20px;
left: 50%;
letter-spacing: 0;
line-height: 1;
position: absolute;
text-indent: -2px;
text-rendering: geometricPrecision;
transform: translate(-50%, -65%);
width: 10px;
}
}
/* Section Break 2 */
.section-break-2 {
background-color: transparent;
border: 0;
border-top: 1px solid $break-color;
height: 1px;
margin: 2rem auto;
text-align: center;
width: 80%;
&:before {
background-color: $page-color;
color: darken($break-color, 20%);
content: '\25C8';
display: inline-block;
font-size: 20px;
left: 50%;
letter-spacing: 0;
line-height: 1;
text-indent: -1px;
text-rendering: geometricPrecision;
transform: translateY(-53%);
width: 15px;
}
}
/* Section Break 3 */
.section-break-3 {
$break-color: $text-color;
background-color: $break-color;
border: 0;
border-top: 1px solid $break-color;
height: 1px;
margin: 2rem auto;
text-align: center;
width: 100%;
&:before {
background-color: $page-color;
color: darken($break-color, 20%);
content: '\25C9';
display: inline-block;
font-size: $body-text-size;
left: 50%;
line-height: 1;
padding: 0 .5rem;
text-rendering: geometricPrecision;
transform: translateY(-53%);
z-index: 1;
}
}
/* Section Break 4 */
.section-break-4 {
border: 0;
background-color: transparent;
height: 0;
margin: 2rem auto 4rem;
text-align: center;
width: 100%;
&:before,
&:after {
background-color: $break-color;
content: '';
height: 1px;
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
width: 7%;
}
&:before {
transform: rotate(10deg);
}
&:after {
transform: rotate(-10deg);
}
}
/* Section Break 5 */
.section-break-5 {
background-color: transparent;
border: 0;
border-top: 1px solid $break-color;
display: block;
height: 0;
margin: 3rem auto 3rem;
text-align: center;
width: 50%;
&:before {
background-color: $page-color;
color: darken($break-color, 20%);
content: 'j';
display: inline-block;
font-size: $body-text-size;
left: 50%;
letter-spacing: 0;
line-height: $body-text-size;
text-indent: 0;
text-rendering: geometricPrecision;
transform: translateY(-65%);
width: 15px;
}
}
.colophon {
border: 0;
border-top: 1px solid $outline-color;
font-size: 1.2rem;
margin-top: 4rem;
overflow: auto;
padding-bottom: 0;
padding-top: 1rem;
text-align: left;
}
dt {
clear: left;
float: left;
font-weight: 600;
line-height: 2;
margin-right: .5rem;
}
dd {
clear: right;
float: left;
line-height: 2;
margin: 0;
}
Also see: Tab Triggers