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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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>
<link href="https://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet">
<div id="main">
<div id="title">Albert Einstein</div>
<div id="title2">The man who created the world's most famous equation</div>
<div id="img-div">
<img id="image" src="https://upload.wikimedia.org/wikipedia/commons/3/38/Einstein_Albert_Elsa_LOC_32096u.jpg" alt="Einstein with his wife">
<div id="img-caption">Albert Einstein with his wife Elsa. Date not recorded. Fur collar from fox or skunks.</div>
</div>
<div id="tribute-info">
<p>Here is a timeline of Albert Einstein's life:</p>
<ul>
<li><b>1879</b> - Albert was born in Ulm, Germany. The family moved to Munich when Albert was one year old.</li>
<li><b>1884</b> - The compass. When Albert was five he was given a compass by his father. He was fascinated by it and how it worked.</li>
<li><b>1889</b> - He met Max Talmud. Max introduced Albert to math and science. Albert was ten years old.</li>
<li><b>1894</b> - Albert finishes school. Albert finished his schooling in Munich with medical training. He moved to Milan with his family.</li>
<li><b>1895</b> - Goes to school in Switzerland. Albert moved to Switzerland at 16 years old to attend Aarau Cantonal School.</li>
<li><b>1896</b> - Top of the class. Albert graduates at the top of his class. He was a year younger than the other students.</li>
<li><b>1901</b> - Hard times. Albert slacked off in further schooling, even after doing so well. Because of this he had a hard time finding a good job.</li>
<li><b>1902</b> - The patent office. Albert Einstein got a job in the patent office. He used his understanding of math and science in his new position, and it made him happy.</li>
<li><b>1905</b> - Submits his first paper. Einstein submitted his first paper on his theory of thermodynamics. It was the first of many.</li>
<li><b>1909</b> - A new job. After working at the patent office and writing his theories, Einstein got a job teaching theoretical physics at the University of Zurich.</li>
<li><b>1911</b> - Attends physics conference. He was given an invitation to the first-ever world physics conference. He was the youngest physicist there.</li>
<li><b>1913</b> - Theory of gravity. He believed science's understanding of gravity was wrong, and he worked on a new theory which he would later test with a solar eclipse.</li>
<li><b>1919</b> - Einstein is famous. After publishing his Theory of Relativity and correctly predicting the effects of a solar eclipse, Einstein's name went around the world.</li>
<li><b>1922</b> - Nobel Prize. Einstein was awarded his first Nobel Prize. He was on his way to Japan when he got the news.</li>
<li><b>1933</b> - America. He visited America for the first time because he feared the rising Nazi party in Germany.</li>
<li><b>1945</b> - War ends. World War II ended and Einstein continued his research. He made advances in heat, gravity, and relativity, and he published over 300 scientific reports.</li>
<li><b>1955</b> - Einstein dies. Albert Einstein died in April of heart failure.</li>
</ul>
<p1>If you have time, you should read more about this incredible human being on his <a id="tribute-link" href="https://en.wikipedia.org/wiki/Albert_Einstein" target="_blank"> Wikipedia entry</a>.</p1>
</div>
</div>
#main {
display: grid;
background-color: lightgrey;
width: 10in;
max-width: 100%;
position: relative;
margin:auto;
top: 10px;
bottom: 10px;
border-style: solid;
border-color: grey;
border-width: 2px;
border-radius: 10px;
padding: 10px 0px 10px 0px
}
#title {
text-align: center;
font-size: 48px;
font-family: Slabo;
font-weight: bold;
padding-bottom: 20px;
}
#title2 {
text-align: center;
font-size: 28px;
}
#img-div {
display: grid;
padding: 10px 10px 20px 10px;
background-color: white;
margin: 10px 10px 10px 10px;
text-align: center;
}
#image {
position: relative;
max-width: 100%;
}
#img-caption {
font-family: sans-serif;
font-weight: bold;
}
#tribute-info {
position: relative;
width: 80%;
left: 10%;
font-family: sans-serif;
font-size: 16px;
}
p {
font-size: 24px;
font-weight: bold;
}
p1 {
font-size: 24px;
}
li {
margin: 10px 0px 20px 0px;
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
Also see: Tab Triggers