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>
<nav class="navbar" id="navbar">
<ul class="navbar-nav">
<li class="logo">
<header class="link-text logo-text" >Html</header>
<svg
aria-hidden="true"
focusable="false"
data-prefix="fad"
data-icon="angle-double-right"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
class="svg-inline--fa fa-angle-double-right fa-w-14 fa-5x"
>
<g class="fa-group">
<path
fill="currentColor"
d="M224 273L88.37 409a23.78 23.78 0 0 1-33.8 0L32 386.36a23.94 23.94 0 0 1 0-33.89l96.13-96.37L32 159.73a23.94 23.94 0 0 1 0-33.89l22.44-22.79a23.78 23.78 0 0 1 33.8 0L223.88 239a23.94 23.94 0 0 1 .1 34z"
class="fa-secondary"
></path>
<path
fill="currentColor"
d="M415.89 273L280.34 409a23.77 23.77 0 0 1-33.79 0L224 386.26a23.94 23.94 0 0 1 0-33.89L320.11 256l-96-96.47a23.94 23.94 0 0 1 0-33.89l22.52-22.59a23.77 23.77 0 0 1 33.79 0L416 239a24 24 0 0 1-.11 34z"
class="fa-primary"
></path>
</g>
</svg>
</a>
</li>
<section id="Elements" class="nav-item">
<a href="#Elements" class="nav-link" >
<span class="link-text">Elements</span>
</a>
</li>
</section>
<li class="nav-item">
<a href="#attributes" class="nav-link">
<span class="link-text">Attributes</span>
</a>
</li>
<li class="nav-item">
<a href="#headings" class="nav-link">
<span class="link-text">Headings</span>
</a>
</li>
<li class="nav-item">
<a href="#paragraphs" class="nav-link">
<span class="link-text">Paragraphs</span>
</a>
</li>
<li class="nav-item">
<a href="#styles" class="nav-link">
<span class="link-text">Styles</span>
</a>
</li>
</ul>
</nav>
<main id="main-doc">
<section class="main-section" id="Elements">
<header><b>Elements</b></header>
<p>An HTML element usually consists of a start tag and an end tag, with the content inserted in between:</p>
<code><tagname>Content goes here...</tagname></code>
<p>The HTML element is everything from the start tag to the end tag:</p>
<p>Here are some common elements
<li><h1>My first heading</h1></li>
<li><p>My first paragraph </p></li>
<li><br></li>
<p>HTML elements with no content are called empty elements. Empty elements do not have an end tag, such as the <br> element (which indicates a line break).</p>
</section>
<section class="main-section" id="attributes">
<header>Attributes</header>
<p>Attributes provide additional information about HTML elements</p>
<li>All HTML elements can have attributes</li>
<li>Attributes provide additional information about an element</li>
<li>Attributes are always specified in the start tag</li>
<li>Attributes usually come in name/value pairs like: name="value"
</li>
<p></p>
<code></code>
</section>
<section class="main-section" id="headings">
<header>Headings</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget pulvinar erat. Fusce vitae gravida diam. Praesent dapibus ligula aliquet elementum laoreet. Morbi ut nisl ullamcorper erat egestas cursus. Aenean rutrum, magna eu congue facilisis, leo orci consectetur tortor, eu condimentum ex diam dictum nisi. Praesent quis odio et diam interdum auctor. Quisque pulvinar sit amet sem ac dictum. Vestibulum sit amet luctus odio.</p>
<p></p>
<code></code>
</section>
<section class="main-section" id="paragraphs">
<header>Paragraphs</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget pulvinar erat. Fusce vitae gravida diam. Praesent dapibus ligula aliquet elementum laoreet. Morbi ut nisl ullamcorper erat egestas cursus. Aenean rutrum, magna eu congue facilisis, leo orci consectetur tortor, eu condimentum ex diam dictum nisi. Praesent quis odio et diam interdum auctor. Quisque pulvinar sit amet sem ac dictum. Vestibulum sit amet luctus odio.
In hac habitasse platea dictumst. Suspendisse eros leo, porttitor sed fermentum nec, sagittis eget velit. Suspendisse sed nunc dolor. Vestibulum ut sagittis libero, sed luctus orci. Quisque pretium mattis ex et blandit. Donec mollis arcu leo, quis convallis sapien ultrices eget. Donec condimentum ornare leo eu luctus. Suspendisse varius feugiat porta.
Nullam massa elit, gravida vel sapien ut, dictum condimentum ipsum. Aliquam dapibus ultricies bibendum. Suspendisse vulputate justo quis ex facilisis, vel cursus est imperdiet. Praesent eu accumsan diam. Nulla et efficitur sem. Mauris ac placerat sem. Sed semper mi nec nibh fermentum tempor. Integer quis sapien ut sapien tristique vehicula ut sed nisl. Mauris metus neque, feugiat et diam vitae, dignissim fringilla est.</p>
<p></p>
<code></code>
</section>
<section class="main-section" id="styles">
<header>Styles</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget pulvinar erat. Fusce vitae gravida diam. Praesent dapibus ligula aliquet elementum laoreet. Morbi ut nisl ullamcorper erat egestas cursus. Aenean rutrum, magna eu congue facilisis, leo orci consectetur tortor, eu condimentum ex diam dictum nisi. Praesent quis odio et diam interdum auctor. Quisque pulvinar sit amet sem ac dictum. Vestibulum sit amet luctus odio.
In hac habitasse platea dictumst. Suspendisse eros leo, porttitor sed fermentum nec, sagittis eget velit. Suspendisse sed nunc dolor. Vestibulum ut sagittis libero, sed luctus orci. Quisque pretium mattis ex et blandit. Donec mollis arcu leo, quis convallis sapien ultrices eget. Donec condimentum ornare leo eu luctus. Suspendisse varius feugiat porta.
Nullam massa elit, gravida vel sapien ut, dictum condimentum ipsum. Aliquam dapibus ultricies bibendum. Suspendisse vulputate justo quis ex facilisis, vel cursus est imperdiet. Praesent eu accumsan diam. Nulla et efficitur sem. Mauris ac placerat sem. Sed semper mi nec nibh fermentum tempor. Integer quis sapien ut sapien tristique vehicula ut sed nisl. Mauris metus neque, feugiat et diam vitae, dignissim fringilla est.</p>
<p></p>
<code></code>
</section>
</main>
body{
font-size:24px;
color:black;
backgroud-color: grey;
margin:0;
padding:0;
}
main{
margin-left:3rem;
padding:3rem;
}
.navbar{
width:5rem;
height:100vh;
position:fixed;
}
.navbar {
position: fixed;
background-color: grey;
transition: width 600ms ease;
overflow: scroll;
}
.navbar-nav {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.nav-item {
width: 100%;
}
.nav-item:last-child {
margin-top: auto;
}
.nav-link {
display: flex;
align-items: center;
height: 5rem;
color: var(--text-primary);
text-decoration: none;
filter: grayscale(100%) opacity(0.7);
transition: var(--transition-speed);
}
.nav-link:hover {
filter: grayscale(0%) opacity(1);
background: var(--bg-secondary);
color: var(--text-secondary);
}
#link-text {
display: none;
margin-left: 1rem;
}
.nav-link svg {
width: 2rem;
min-width: 2rem;
margin: 0 1.5rem;
}
.fa-primary {
color: #ff7eee;
}
.fa-secondary {
color: #df49a6;
}
.fa-primary,
.fa-secondary {
transition: var(--transition-speed);
}
.logo {
font-weight: bold;
text-transform: uppercase;
margin-bottom: 1rem;
text-align: center;
color: var(--text-secondary);
background: var(--bg-secondary);
font-size: 1.5rem;
letter-spacing: 0.3ch;
width: 100%;
}
.logo svg {
transform: rotate(0deg);
transition: var(--transition-speed);
transition-duration:1s;
}
.logo-text
{
display: inline;
position: absolute;
left: -999px;
transition: var(--transition-speed);
}
.navbar:hover .logo svg{
transform: rotate(-180deg);
}
/* Small screens */
@media only screen and (max-width: 600px) {
.navbar {
bottom: 0;
width: 100vw;
height: 10rem;
}
.logo {
display: none;
}
.navbar-nav {
flex-direction: row;
}
.nav-link {
justify-content: center;
}
main {
margin: 0;
}
}
/* Large screens */
@media only screen and (min-width: 600px) {
.navbar {
top: 0;
width: 5rem;
height: 100vh;
}
.navbar:hover {
width: 16rem;
}
.navbar:hover .link-text {
display: inline;
}
.navbar:hover .logo svg
{
margin-left: 11rem;
}
.navbar:hover .logo-text
{
left: 45px;
top:15px;
font-size:35px;
}
body::-webkit-scrollbar {
width: 0.75rem;
}
body::-webkit-scrollbar-track {
background: #1e1e24;
}
body::-webkit-scrollbar-thumb {
background: #6649b8;
}
Also see: Tab Triggers