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.
<div class="content">
<h1>Frankenstein</h1>
<h3><i>Scroll Down and the Scroll Back to Top button would appear.</i></h3>
<p>
You will rejoice to hear that no disaster has accompanied the commencement of
an enterprise which you have regarded with such evil forebodings. I arrived
here yesterday, and my first task is to assure my dear sister of my welfare and
increasing confidence in the success of my undertaking.
</p>
<p>
I am already far north of London, and as I walk in the streets of Petersburgh,
I feel a cold northern breeze play upon my cheeks, which braces my nerves and
fills me with delight. Do you understand this feeling? This breeze, which has
travelled from the regions towards which I am advancing, gives me a foretaste
of those icy climes. Inspirited by this wind of promise, my daydreams become
more fervent and vivid. I try in vain to be persuaded that the pole is the seat
of frost and desolation; it ever presents itself to my imagination as the
region of beauty and delight. There, Margaret, the sun is for ever visible, its
broad disk just skirting the horizon and diffusing a perpetual splendour.
There—for with your leave, my sister, I will put some trust in preceding
navigators—there snow and frost are banished; and, sailing over a calm sea, we
may be wafted to a land surpassing in wonders and in beauty every region
hitherto discovered on the habitable globe. Its productions and features may be
without example, as the phenomena of the heavenly bodies undoubtedly are in
those undiscovered solitudes. What may not be expected in a country of eternal
light? I may there discover the wondrous power which attracts the needle and
may regulate a thousand celestial observations that require only this voyage to
render their seeming eccentricities consistent for ever. I shall satiate my
ardent curiosity with the sight of a part of the world never before visited,
and may tread a land never before imprinted by the foot of man. These are my
enticements, and they are sufficient to conquer all fear of danger or death and
to induce me to commence this laborious voyage with the joy a child feels when
he embarks in a little boat, with his holiday mates, on an expedition of
discovery up his native river. But supposing all these conjectures to be false,
you cannot contest the inestimable benefit which I shall confer on all mankind,
to the last generation, by discovering a passage near the pole to those
countries, to reach which at present so many months are requisite; or by
ascertaining the secret of the magnet, which, if at all possible, can only be
effected by an undertaking such as mine.
</p>
<p>
These reflections have dispelled the agitation with which I began my letter,
and I feel my heart glow with an enthusiasm which elevates me to heaven, for
nothing contributes so much to tranquillise the mind as a steady purpose—a
point on which the soul may fix its intellectual eye. This expedition has been
the favourite dream of my early years. I have read with ardour the accounts of
the various voyages which have been made in the prospect of arriving at the
North Pacific Ocean through the seas which surround the pole. You may remember
that a history of all the voyages made for purposes of discovery composed the
whole of our good Uncle Thomas’ library. My education was neglected, yet I was
passionately fond of reading. These volumes were my study day and night, and my
familiarity with them increased that regret which I had felt, as a child, on
learning that my father’s dying injunction had forbidden my uncle to allow me
to embark in a seafaring life.
</p>
<p>
These visions faded when I perused, for the first time, those poets whose
effusions entranced my soul and lifted it to heaven. I also became a poet and
for one year lived in a paradise of my own creation; I imagined that I also
might obtain a niche in the temple where the names of Homer and Shakespeare are
consecrated. You are well acquainted with my failure and how heavily I bore the
disappointment. But just at that time I inherited the fortune of my cousin, and
my thoughts were turned into the channel of their earlier bent.
</p>
<p>
Six years have passed since I resolved on my present undertaking. I can, even
now, remember the hour from which I dedicated myself to this great enterprise.
I commenced by inuring my body to hardship. I accompanied the whale-fishers on
several expeditions to the North Sea; I voluntarily endured cold, famine,
thirst, and want of sleep; I often worked harder than the common sailors during
the day and devoted my nights to the study of mathematics, the theory of
medicine, and those branches of physical science from which a naval adventurer
might derive the greatest practical advantage. Twice I actually hired myself as
an under-mate in a Greenland whaler, and acquitted myself to admiration. I must
own I felt a little proud when my captain offered me the second dignity in the
vessel and entreated me to remain with the greatest earnestness, so valuable
did he consider my services.
</p>
<p>
And now, dear Margaret, do I not deserve to accomplish some great purpose? My
life might have been passed in ease and luxury, but I preferred glory to every
enticement that wealth placed in my path. Oh, that some encouraging voice would
answer in the affirmative! My courage and my resolution is firm; but my hopes
fluctuate, and my spirits are often depressed. I am about to proceed on a long
and difficult voyage, the emergencies of which will demand all my fortitude: I
am required not only to raise the spirits of others, but sometimes to sustain
my own, when theirs are failing.
</p>
</div>
<a href="#" id="scrollToTopButton" style="display: none;">↑</a>
#scrollToTopButton {
position: fixed;
bottom: 30px;
right: 30px;
background-color: #0073aa;
color: white;
padding: 10px 15px;
border-radius: 5px;
text-align: center;
cursor: pointer;
z-index: 1000;
font-size: 16px;
text-decoration: none;
}
#scrollToTopButton:hover {
background-color: #005177;
}
.content {
width: 77%;
margin: 50px auto;
font-family: 'Merriweather', serif;
font-size: 20px;
color: #6c767a;
line-height: 1.9;
}
h1{
font:Merriweather';
}
document.addEventListener("DOMContentLoaded", function() {
var scrollToTopButton = document.getElementById("scrollToTopButton");
window.addEventListener("scroll", function() {
if (window.pageYOffset > 300) {
scrollToTopButton.style.display = "block";
} else {
scrollToTopButton.style.display = "none";
}
});
scrollToTopButton.addEventListener("click", function(e) {
e.preventDefault();
window.scrollTo({ top: 0, behavior: 'smooth' });
});
});
Also see: Tab Triggers