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.
<main id="main">
<h1 id="title"><strong>NELSON MANDELA</strong></h1>
<p>He was a South African anti-apartheid revolutionary, political leader,
and philanthropist who spent 27 years as political prisoner before becoming, <em>and a remarkable twist</em> the
country's first black president.</p>
<figure id="img-div">
<img id="image">
<img
class="pic-border"
src="https://www.theguardian.com/world/gallery/2013/dec/05/nelson-mandela-life-in-pictures#img-1.jpg"
alt="photo of Nelson mandela">
<figcaption id="img-caption"><strong>Nelson Mandela making closed fist "POWER TO THE PEOPLE" salute.</strong></figcaption>
</figure>
<section id="tribute-info">
<h3 id="headline">Here's a time line of Nelson Mandela's life:</h3>
<ul>
<li><strong>1918</strong> - Born in Mveso, Cape province, South Africa</li>
<li><strong>1938</strong> - Attends University of Fort Hare</li>
<li><strong>1944</strong> - First Marriage</li>
<li><strong>1944</strong> - Forms the A.N.C Youth League</li>
<li><strong>1952</strong> - Mandela starts law practise</li>
<li><strong>1956</strong> - Mandela arrested on treason charges, by apartheid goverment</li>
<li><strong>1958</strong> - Second marriage, during trial</li>
<li><strong>1961</strong> - Acquitted of treason</li>
<li><strong>1961</strong> - Mandela helps form querrilla army</li>
<li><strong>1962</strong> - Mandela arrested again</li>
<li><strong>1964</strong> - Sentenced to life in prison</li>
<li><strong>1990</strong> - Mandela freed</li>
<li><strong>1992</strong> - Breakup of second marriage</li>
<li><strong>1993</strong> - Mandela awarded with the Nobel Peace Price</li>
<li><strong>1994</strong> - Mandela becomes President</li>
<li><strong>1998</strong> - Third marriage at 80</li>
<li><strong>1999</strong> - Succeeded by Thabo Mbeki</li>
<li><strong>2013</strong> - Dies at the age 95.</li>
</ul>
<blockquote
cite="http:// ">
<h5>QUOTES</h5>
<p>"During my lifetime I have dedicated myself to this struggle of the African people. I have fought against white
domination. I have fought against black domination. I have cherished the ideal of a democratic and free society in which
all persons live together in harmony and with equal opportunities. It is an ideal which I hope to live for and to achieve.
But if needs be, it is an ideal for which I am prepared to die."</p>
<p>"For to be free is not merely to cast off one's chains, but to live in a way that respects
and enhances the freedom of others."
</p>
<p>
"The greatest glory in living lies not in never falling, but in rising every time we fall."
</p>
<p>
"In my country we go to prison first and then become President."</p>
</cite>
</bockquote>
<h3>Read more about this incredible human being on his
<a id="tribute-link"
href="https://en.wikipedia.org/wiki/Nelson_Mandela"
target="_blank">wikipedia entry</a>.
</h3>
</section>
</main>
</html>
@import url('http://fonts.googleapis.com/css?family=Allerta+Stencil');
html {
font-size: 12px;
}
body {
font-family: "Allerta Stencil", Lato, "Monotype Corsiva", Gisha, "Bradley Hand IT", verdana, sans-serif;
font-size: 1.6rem;
line-height: 1.5;
text-align: center;
color: Dark-brown;
margin: 0;
}
h1 {
font-family: "Cooper Black", Castellar, "bauhaus 93", Broadway;
font-size: 4rem;
color: #08708a;
text-shadow: 2px 2px 5px cyan;
margin-bottom: 0;
}
@media (max-width: 460px) {
h1 {
font-size: 300%;
line-height: 1.2;
}
}
h5 {
font-size: 3.25rem;
color: teal;
}
a {
color: red;
}
a:visited {
color: #74638f;
}
#main {
margin: 30px 8px;
padding: 15px;
border: #FFDEAD solid 10px;
border-radius: 40px;
background: #f7dfd4;
}
@media (max-width: 460px) {
#main {
margin: 0;
}
}
img {
max-width: 100%;
display: block;
height: auto;
margin: 0 auto;
}
#img-div {
background: repeating-linear-gradient(45deg, #eabcac, #ffe4c4, #f7dfd4 40px);
border: #ffdead solid 10px;
border-radius: 40px;
padding: 10px;
margin: 0;
}
#img-caption {
margin: 15px 0 5px 0;
color: teal;
}
.pic-border {
border-color: #ffdead;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
@media (max-width: 460px) {
#img-caption {
font-size: 1.4rem;
}
}
#headline {
margin: 50px 0;
text-align: center;
}
ul {
max-width: 550px;
margin: 0 auto 50px auto;
text-align: left;
line-height: 1.6;
}
li {
margin: 16px 0;
}
blockquote {
font-style: italic;
max-width: 545px
margin: 0 auto 50px auto;
text-align: left;
}
Also see: Tab Triggers