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>
<head>
<title>
Nelson Mandela - tribute page
</title>
</head>
<main id="main">
<h1 id="title">
Nelson Mandela
</h1>
<p>
Human rights activist and Nobel Prize winner
</p>
<div id="img-div">
<img id="image" src="https://images.unsplash.com/photo-1512844417531-fd0e4fc0af27?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8bmVsc29uJTIwbWFuZGVsYXxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt="Nelson Mandela graffiti">
<p id="img-caption">
Nelson Mandela graffiti in Hermanus, South Africa, fot. John-Paul Henry
</p>
</div>
<h1>
Some facts from Mandela's life:
</h1>
<section id="tribute-info">
<h2>Childhood</h2>
<ul>
<li>Nelson Mandela was born into the Thembu royal family in Mvezo on 18 July 1918</li>
<li>When he was born, his name was Rolihlahla Mandela and his birth name means "to pull a branch off a tree" and "troublemaker."</li>
<li>Nelson was the youngest son of Mphakanyiswa, who had four wives and thirteen children (four boys and nine girls).</li>
<li>Mphakanyiswa served as a counselor to Jongintaba Dalindyebo, the acting king of South Africa's Thembu tribe.</li>
<li>After his father's death, Nelson became the ward of Jongintaba and was raised in the acting king's palace.</li>
</ul>
<h2>Education and Early Career</h2>
<ul>
<li>Mandela was given the name Nelson as a seven-year-old student in a Qunu primary school. (It was customary for schoolchildren to be given Christian names).</li>
<li>After completing secondary school, he enrolled in Fort Hare Missionary College to seek a B.A. degree.</li>
<li>He was thrown out of Fort Hare in 1940 for organizing a strike against the white rule of the college.</li>
<li>He earned his B.A. degree in 1943 from Fort Hare, though he completed his coursework through the University of South Africa.</li>
<li>He then studied law at the University of Witwatersrand. He earned a two-year diploma in law (which allowed him to practice law) but did not earn an LLB degree.</li>
<li>In 1944, Mandela joined the African National Congress (ANC) and played a pivotal role in forming the ANC Youth League.</li>
<li>In 1952, he became leader of the Defiance Campaign, speaking out through civil disobedience against South Africa's unjust apartheid practices.</li>
<li>Also in 1952, he and Tambo (his friend from Fort Hare) formed Mandela & Tambo, South Africa's first Black-owned law firm.</li>
<li>He was arrested and tried several times for his activism against the country's unjust system of racial segregation.</li>
</ul>
<h2>Mandela's Imprisonment</h2>
<ul>
<li>In 1964, Nelson Mandela was sentenced to life in prison. He served 27 years of that sentence before being released in 1990.</li>
<li>He was imprisoned on Robben Island for 18 years before being moved to two other South African prisons.</li>
<li>In 1968, both his mother and son passed away. However, he was not permitted out of prison to attend their funerals. His only son passed away due to AIDS.</li>
<li>During his time in prison, he was able to have secret talks with F. W. de Klerk, the President of South Africa. Due to these talks, he was able to be freed.</li>
<li>In 1989, toward the end of his time in prison, Mandela earned his LLB degree from the University of South Africa.</li>
</ul>
<h2>From Prison to South Africa's Presidency</h2>
<ul>
<li>Upon his release from prison, Mandela quickly rose to a leadership role in the African National Conference (ANC), then was elected to serve as president of South Africa.</li>
<li>He was elected Deputy President of the ANC in 1990.</li>
<li>In 1992, he was elected President of the ANC.</li>
<li>In 1993, Mandela shared the Nobel Peace Prize with F.W. de Klerk. They received this Nobel Peace Prize for getting rid of the apartheid system.</li>
<li>
In 1994, he became the first president of South Africa to be elected by a democratic election in which the African National Congress was allowed to participate.
</li>
<li>Once he was finished with his presidency, he became an advocate in support of people suffering from AIDS.</li>
</ul>
<p> Source: <a class="a" href="https://biography.yourdictionary.com/articles/nelson-mandela-facts.html" target="_blank">https://biography.yourdictionary.com</a></p>
</section>
<section class="quote">
<p>
“I learned that courage was not the absence of fear, but the triumph over it. The brave man is not he who does not feel afraid, but he who conquers that fear.” - N. Mandela
</p>
</section>
<footer>
<p>
More information about this remarkable man you can find <a class="a" href="https://en.wikipedia.org/wiki/Nelson_Mandela" id="tribute-link" target="_blank">here</a>.
</p>
</footer>
</main>
#main {
font-family: Roboto, sans-serif;
color: #444;
}
#title {
font-size: 2em;
display: flex;
justify-content: center;
margin: 50px 25vw 30px;
/* padding: 7px;
background-color: #ded; */
}
h1 + p {
display: flex;
justify-content: center;
padding: 10px;
margin: 0 15vw 40px 15vw;
/* background-color: #eee; */
font-size: 1.1rem;
}
#img-div {
display: flex;
align-items: center;
flex-direction: column;
background-color: #eee;
padding: 30px;
margin: 2vw;
border-radius: 20px;
}
#img-caption {
color: #aba;
margin-top: 10px;
margin-bottom: 20px;
display: flex;
justify-content: center;
}
#image {
/* display: block; */
width: 50vw;
max-width: 100%;
border: 4px solid #cdc;
box-shadow: 5px 4px 7px 0px #aaa;
border-radius: 10px;
/* margin: 0 auto; */
}
#tribute-info {
width: 85vw;
font-size: 1.2rem;
/* margin: 0 auto 0 auto; */
/* text-align: center; */
}
div + h1,
li {
margin: 30px 5vw 20px 18vw;
}
ul + p {
margin: 30px 10vw 20px 18vw;
}
h2 {
margin: 50px 20vw;
font-size: 1.3em;
text-decoration: underline;
}
.quote {
font-style: italic;
font-size: 1.2em;
background-color: #bbe;
width: 25vw;
margin: 0 auto;
padding: 2%;
border-radius: 5px;
}
footer {
background-color: #eee;
padding: 7px;
margin: 0.7vw;
border-radius: 5px;
}
footer p {
font-size: 1.2rem;
text-align: center;
}
.a {
text-decoration: none;
color: #66f;
}
.a:hover {
color: #aae;
}
@media (max-width: 600px) {
h1,
h2,
li,
.quote,
footer,
h1 + p {
margin: 5px auto;
width: auto;
text-align: center;
}
#img-caption {
text-align: center;
font-size: 1em;
}
div + h1 {
font-size: 1.6em;
margin: 15px auto;
width: auto;
text-align: center;
}
#tribute-info,
li {
margin: 20px auto;
width: auto;
text-align: left;
font-size: 1em;
}
ul + p {
margin: 0 auto;
}
.quote,
footer p {
font-size: 1rem;
}
}
Also see: Tab Triggers