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.
<body>
<div id="grid">
<nav id="navbar">
<header id="headline">
Bob Ross Ipsum
</header>
<a href="#Clouds_are_free" id="cloud" class="nav-link">Clouds are free</a>
<a href="#Unlimited_time" id="time" class="nav-link">Unlimited time</a>
<a href="#Take_your_time" id="take" class="nav-link">Take your time</a>
<a href="#Lets_get_wild_today" id="wild" class="nav-link">Lets get wild today</a>
<a href="#These_little_son_of_a_guns" id="guns" class="nav-link">These little son of a guns</a>
</nav>
<main id="main-doc">
<section class="main-section" id="Clouds_are_free">
<header>
Clouds are free
</header>
<p>They just float around the sky all day and have fun. If you do too much it's going to lose its effectiveness. You have to allow the paint to break to make it beautiful. With something so strong, a little bit can go a long way. Trees get lonely too, so we'll give him a little friend. Son of a gun.</p>
<ul>
<li>Fluff it up a little and hypnotize it.</li>
<li>You don't have to be crazy to do this but it does help.</li>
<li>Decide where your cloud lives.</li>
<li> Maybe there's a happy little bush that lives right there.</li>
<li>I like to beat the brush.</li>
</ul>
<code>Even the worst thing we can do here is good. Don't hurry. Take your time and enjoy. In nature, dead trees are just as normal as live trees. And I will hypnotize that just a little bit. All kinds of happy little splashes.</code>
<p>You can create beautiful things - but you have to see them in your mind first. I really recommend you use odorless thinner or your spouse is gonna run you right out into the yard and you'll be working by yourself. I started painting as a hobby when I was little. I didn't know I had any talent. I believe talent is just a pursued interest. Anybody can do what I do.</p>
</section>
<section class="main-section" id="Unlimited_time">
<header>
Unlimited time
</header>
<p>Only think about one thing at a time. Don't get greedy. I can't think of anything more rewarding than being able to express yourself to others through painting.</p>
<code>We don't have to be concerned about it. We just have to let it fall where it will. Trees grow in all kinds of ways. They're not all perfectly straight. Not every limb is perfect. Here's something that's fun.</code>
<p>
Trees get lonely too, so we'll give him a little friend. Those great big fluffy clouds. Let's put some highlights on these little trees. The sun wouldn't forget them.</p>
</section>
<section class="main-section" id="Take_your_time">
<header>
Take your time
</header>
<p>Speed will come later. You're meant to have fun in life. It's hard to see things when you're too close. Take a step back and look. A fan brush is a fantastic piece of equipment. Use it. Make friends with it.</p>
<code>You are only limited by your imagination. We don't want to set these clouds on fire. Isn't it great to do something you can't fail at?</code>
<p>Let's give him a friend too. Everybody needs a friend. Let's do it again then, what the heck. This is probably the greatest thing that's ever happened in my life.</p>
</section>
<section class="main-section" id="Lets_get_wild_today">
<header>
Lets get wild today
</header>
<p>Brown is such a nice color. I'm sort of a softy, I couldn't shoot Bambi except with a camera. I really believe that if you practice enough you could paint the 'Mona Lisa' with a two-inch brush. But they're very easily killed. Clouds are delicate.</p>
<code>
A tree cannot be straight if it has a crooked trunk. You got your heavy coat out yet? It's getting colder. As trees get older they lose their chlorophyll.</code>
<p>Paint anything you want on the canvas. Create your own world. At home you have unlimited time. Just use the old one inch brush. We start with a vision in our heart, and we put it on canvas. A beautiful little sunset.</p>
</section>
<section class="main-section" id="These_little_son_of_a_guns">
<header>
These little son of a guns
</header>
<p>hide in your brush and you just have to push them out. Use your imagination, let it go. We need dark in order to show light. When you do it your way you can go anywhere you choose. See there how easy that is. You can do anything here. So don't worry about it.</p>
<code>Have fun with it. Anytime you learn something your time and energy are not wasted. But we're not there yet, so we don't need to worry about it.</code>
<p>If we're going to have animals around we all have to be concerned about them and take care of them. You can get away with a lot. That's what makes life fun. That you can make these decisions. That you can create the world that you want. Maybe there's a happy little bush that lives right there.</p>
</section>
</main>
</div>
</body>
@import url('https://fonts.googleapis.com/css?family=Sunflower:300');
body {
font-family: 'Sunflower', sans-serif;
font-size: 16px;
color:#555555;
}
#grid {
display:grid;
grid-template-columns: 300px auto;
grid-template-rows: auto;
grid-template-areas: "nav main";
grid-column-gap: 15px;
}
nav {
grid-area: nav;
grid-template-columns: 300px;
grid-template-rows: 50px 50px 50px 50px 50px 50px 50px;
grid-template-areas: "." "headline" "cloud" "time" "take" "wild" "guns";
display:grid;
width:300px;
height:100%;
border-right:1px solid #a4dbc7;
position:fixed;
}
nav a{
text-decoration: none;
color: #598978;
}
nav a:hover{
text-decoration: none;
color: #598978;
}
nav a:visited{
text-decoration: none;
color: #598978;
}
header {
font-size: 25px;
font-weight:bold;
}
#headline {
grid-area: headline;
font-size: 25px;
height:50px;
font-weight:bold;
margin: 0 0 10px 0;
border-bottom: 1px solid #555555;
}
#cloud {
grid-area: cloud;
font-size: 25px;
margin: 0 0 0 0;
align-self:center;
}
#time {
grid-area: time;
font-size: 25px;
margin: 0 0 0 0;
align-self:center;
}
#take {
grid-area: take;
font-size: 25px;
margin: 0 0 0 0;
align-self:center;
}
#wild {
grid-area: wild;
font-size: 25px;
margin: 0 0 0 0;
align-self:center;
}
#guns {
grid-area: guns;
font-size: 25px;
margin: 0 0 0 0;
align-self:center;
}
main {
grid-area: main;
}
@media only screen and (max-width: 600px) {
nav {
display: none !important;
}
}
Also see: Tab Triggers