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.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<div style="max-width: 90%; margin: 0 auto; padding: 20px; background-color: #d3d3d3; border-radius: 5px;">
<main id="main">
<h1 id="title">James Clerk Maxwell</h1>
<p>The man who unified electricity and magnetism</p>
<figure id="img-div">
<img
id="image"
src="https://upload.wikimedia.org/wikipedia/commons/e/ec/James_clerk_maxwell.jpg"
alt="Maxwell"
/>
<figcaption id="img-caption">James Clerk Maxwell
</figcaption>
</figure>
<section id="tribute-info">
<h3 id="headline">The life of Maxwell:</h3>
<ul>
<li><b>1831</b> - Born in Edinburgh, Scotland on June 13.</li>
<li><b>1841</b> - Begins attending Edinburgh Academy.</li>
<li><b>1842</b> - Attends Robert Davidson's demonstration of electric propulsion and magnetic force on Feb. 12.</li>
<li><b>1842</b> - Wins Edinburgh Academy's scripture biography prize.</li>
<li><b>1844</b> - Wins Edinburgh Academy's mathematical medal, as well as, first prize in English and poetry.</li>
<li><b>1845</b> - Wrote his first scientific paper called "Oval Curves".</li>
<li><b>1847</b> - Started attending the University of Edinburgh at age 16.</li>
<li><b>1849</b> - Contributes two papers for Transactions of the Royal Society of Edinburgh called "On the Equilibrium of Elastic Solids" and "Rolling Curves".</li>
<li><b>1850</b> - Leaves Scotland to attend the University of Cambridge. First studying at Peterhouse, later, transferring to Trinity.</li>
<li><b>1851</b> - Begins studying under William Hopkins.</li>
<li><b>1854</b> - Graduates from Trinity with a degree in mathematics. Reads his paper"On the Transformation of Surfaces by Bending" to the Cambridge Philosophical Society.</li>
<li><b>1855</b> - Writes "Experiments on Colour" and presents it to the Royal Society of Edinburgh in March. Later, in October, he was made a fellow of Trinity.</li>
<li><b>1856</b> - Leaves Cambridge for a professorship at Aberdeen.</li>
<li><b>1858</b> - Marries Katherine Mary Dewar.</li>
<li><b>1859</b> - Awarded the Adams prize for his essay "On the stability of the motion of Saturn's rings."</li>
<li><b>1860</b> - Gets laid off from Aberdeen, but, is granted the Chair of Natural Philosophy at King's College, London. Him and his wife move to London. He is awarded the Royal Society's Rumford Medal for his work on color.</li>
<li><b>1861</b> - Publishes his two-part paper "On physical lines of force". He also demonstrated the world's first color photo.</li>
<li><b>1862</b> - Calculated that the speed of propagation of electromagnetic fields were equal to the speed of light.</li>
<li><b>1865</b> - Resigns from his chair at King's College.</li>
<li><b>1871</b> - Returns to Cambridge to become the first Cavendish Professor of Physics. He also wrote the textbook <u>Theory of Heat</u>.</li>
<li><b>1873</b> - Publishes textbook <u>A Treatise of Electricity and Magnetism</u>.</li>
<li><b>1876</b> - Wrote the treatise <u>Matter and Motion</u>.</li>
<li><b>1879</b> - Dies of abdominal cancer at age 48.</li>
</ul>
</div>
<h3>
To learn more about Maxwell go to his
<a id="tribute-link" href="https://en.m.wikipedia.org/wiki/James_Clerk_Maxwell" target="_blank">Wiki</a>.</h3>
</section>
</main>
html {
font-size: 10px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Helvetica Neue", Arial, sans-serif, Times;
font-size: 1.6rem;
line-height: 1.5;
text-align: center;
color: #333;
margin: 6px;
}
h1 {
font-size: 4rem;
margin-bottom: 0;
}
ul {
max-width: 550px;
margin: 0 auto 50px auto;
text-align: left;
line-height: 1.6;
}
li {
margin: 16px 0;
}
@media(max-width:460px) {
#main {
margin:0;}
}
img {
max-width:100%;
display: block;
height: auto;
margin:0 auto;
}
#img-div {
background: rgb( 30,30,30);
padding: 10px;
margin: 0;
border-radius: 2px;
}
#img-caption {
margin: 15px 0 5px 0;
color: white;
}
Also see: Tab Triggers