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 URLs 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 its URL and the proper URL extension.
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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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.
<h1><span>Lorem</span> ipsum dolor sit amet</h1>
<article>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Libero dicta consectetur sequi eveniet iste numquam iusto obcaecati cumque eligendi quod esse quos officiis quo maiores pariatur sed eaque commodi nisi?</p>
<p>Molestiae delectus enim laboriosam quae sequi consequuntur obcaecati perferendis iste necessitatibus nisi voluptas asperiores error quidem excepturi explicabo ut porro autem esse! Quisquam consequuntur culpa et sunt consequatur quaerat voluptatibus.</p>
<p>Voluptas provident qui odio soluta architecto necessitatibus similique voluptate. Eius ut eos. Ab qui deserunt inventore vero modi molestiae placeat sunt earum nulla in recusandae perferendis eaque consectetur nobis assumenda.</p>
<p>Error eius eos odio corporis laudantium ea recusandae excepturi voluptas a obcaecati libero ducimus perspiciatis? Quam temporibus sunt harum porro quia a nam dicta minus iusto ipsum est alias nostrum!</p>
<p>Nisi fugit modi eius porro ullam omnis perspiciatis a voluptate praesentium necessitatibus laboriosam harum impedit molestias nam eos numquam laudantium iure veritatis dolorum aut totam quisquam placeat asperiores cupiditate illum!</p>
<p>Nostrum perferendis deserunt illo quis vel beatae nisi possimus eius necessitatibus maxime voluptatum quasi porro laudantium quibusdam consectetur blanditiis temporibus repellendus nam perspiciatis incidunt mollitia tempore dicta omnis soluta voluptatibus!</p>
<p>Et consequuntur ipsa sed dolor voluptatem cum quas nam temporibus distinctio nemo explicabo exercitationem labore quam repellat repudiandae odit eos provident. Nesciunt sunt odio sequi labore placeat blanditiis itaque magnam.</p>
<p>Est quis blanditiis cumque cum officiis id minus facilis dolor assumenda vitae ducimus quidem iste voluptatem vel explicabo molestiae consectetur a dicta animi repudiandae culpa perspiciatis corrupti consequuntur eius incidunt?</p>
<p>Harum repellendus maiores ex blanditiis eveniet ullam tempora quos nobis dolores eaque modi quia dolorum quidem rerum possimus obcaecati quo. Fugit magni asperiores ut quidem animi facilis odit accusamus dolor.</p>
<p>Voluptatibus blanditiis ducimus itaque distinctio earum voluptatem in totam voluptates sunt qui dolorum at nostrum omnis nihil fugiat quos id temporibus nisi dicta perferendis reprehenderit ipsa sit consectetur! Enim hic?</p>
<p>Beatae sint magnam facere atque in molestiae iste illum nulla nam aperiam quas tempora quaerat autem enim reiciendis? At debitis iure ab minima quidem alias facilis sit enim nesciunt placeat.</p>
<p>Ad eveniet quos asperiores laborum doloribus eius quibusdam iste harum exercitationem id repellat natus qui tempore reiciendis quod nobis accusantium dolore beatae enim reprehenderit accusamus corporis sit officiis pariatur aperiam!</p>
<p>Dolor minima iure voluptate ipsam error repudiandae minus cum tenetur laborum assumenda accusantium incidunt maiores veritatis odit obcaecati blanditiis distinctio iste sunt provident ratione itaque quo deleniti asperiores ad velit.</p>
<p>Labore itaque quibusdam voluptatum provident rem magnam sed aliquam iusto tenetur repellat velit culpa alias earum dolor sapiente neque quisquam maiores ad praesentium sint quidem autem nam architecto ea quae?</p>
<p>Obcaecati ad at! Culpa ad neque tempora suscipit fugit odio ea tempore possimus repellendus commodi delectus excepturi consequuntur? Nesciunt dolores temporibus molestias id corrupti placeat possimus in at quae libero!</p>
<p>Sit ipsam molestias totam culpa itaque eum iste dolorem nisi tempora maxime rerum reiciendis provident eos natus ut doloribus unde esse reprehenderit ipsa architecto quas at saepe consequuntur eaque repudiandae.</p>
</article>
<aside>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</aside>
<nav role='navigation'>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
<footer>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</footer>
@import "compass/css3";
// Color
$primary: #21B16B; // <<< CHANGE THIS
$secondary: adjust-hue($primary, 180); // << Complementary color scheme
// Layout
$nav-height: 2em;
body {
padding: $nav-height 10% 0 10%;
margin: 0 auto;
max-width: 50em;
font-family: Verdana, sans-serif;
font-size: 14px;
line-height: 1.5;
@media (max-width: 20em) {
font-size: 12px;
}
}
a {
color: darken($primary, 2%); // Link colors
}
ul, li {
list-style: none;
margin: 0;
padding: 0;
}
nav {
position: fixed;
top: 0;
left: 0;
right: 0;
padding: 0 10%;
height: $nav-height;
background-color: $primary; // Set nav to primary color
font-family: Helvetica, sans-serif;
font-weight: 300;
ul {
max-width: 50em;
margin: 0 auto;
}
li {
float: left;
// Secondary color scheme on sidebar
border-right: 1px solid lighten($primary, 3%);
&:first-child {
border-left: 1px solid lighten($primary, 3%)
}
}
a {
display: inline-block;
background-color: darken($primary, 2%);
padding: .5em;
line-height: 1;
text-decoration: none;
@include transition(all .2s);
// Logic to detect lightness of primary color for nav
@if lightness(darken($primary, 2%)) < 50 {
color: white;
} @else {
color: black;
}
&:hover {
border-bottom: 3px solid lighten($secondary, 20%);
}
}
}
h1 {
font-family: Georgia, serif;
font-weight: 400;
line-height: 1;
margin: 1em 0 .4em 0;
padding: .4em 0 0 0;
border-top: 2px solid mix(white, $primary, 90%);
span {
padding: .33em 0 0 0;
border-top: 2px solid mix(white, $primary, 50%);
}
@media (min-width: 30em) {
font-size: 3em;
}
}
article {
}
aside {
background-color: mix(white, $secondary, 90%);
overflow: hidden;
padding: .5em 1em;
border-top: 2px solid $secondary;
font-size: .8em;
margin-top: 3em;
li {
border-top: 1px solid white;
padding: .5em 0;
&:first-child {
border: none;
padding-top: 0;
}
}
}
footer {
clear: both;
background-color: $primary;
padding: 1em 1em 2em 1em;
// Logic to detect lightness of primary color for footer
a {
@if lightness(darken($primary, 2%)) < 50 {
color: white;
} @else {
color: black;
}
}
}
@media (min-width: 40em) {
article {
width: 66%;
float: left;
padding-right: 1em;
}
}
Also see: Tab Triggers