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.
<!-- Style Guide for http://wwww.lesliefhudson.com -->
<div class="style-tile">
<p class="description">logo + branding</p>
<div class="logo">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/167497/leslie_temp_logo.png" alt="Leslie Hudson's Logo"/>
</div>
<p class="description">colors</p>
<div class="colors">
<ul>
<li class="color-1">
<span>#4e4e4e</span>
</li>
<li class="color-2">
<span>#7c7c7c</span>
</li>
<li class="color-3">
<span>#aa9e7e</span>
</li>
<li class="color-4">
<span>#d6cfc4</span>
</li>
<li class="color-5">
<span>#244145</span>
</li>
<li class="color-5-text">
<span>#41767d</span>
</li>
<li class="color-6">
<span>#a9c3c0</span>
</li>
<li class="color-7">
<span>#562d49</span>
</li>
<li class="color-7-text">
<span>#6e395d</span>
</li>
<li class="color-8">
<span>#a293a3</span>
</li>
<li class="color-9">
<span>#efeeed</span>
</li>
</ul>
</div>
<p class="description">typography</p>
<div class="typography">
<p class="type">h1</p>
<h1>A Day In The Life of a Beekeeper with Bryer Apiary</h1>
<p class="type">h2</p>
<h2>Work With Me</h2>
<p class="type">h3</p>
<h3>Can't wait to tell the world your story?</h3>
<p class="type">h4</p>
<h4>Don't miss a single post</h4>
</div>
<p class="description">body copy</p>
<div class="copy">
<p>Monday through Thursday, you can find Jeff Bryer dishing psychology advice, but on weekends you’ll most likely find him surrounded by thousands of bees. Jeff has been a “hobby” beekeeper for 12 years and has over 30 beehives in five locations throughout Chester County. As the owner of Bryer Apiary and a member of the Chester County Beekeepers Association, Jeff was kind enough to teach me about the job of a beekeeper.</p>
<p>My instructions before my visit were simple – wear light colors, because dark colors remind bees of the their predators (bears, birds, skunks, etc). Before Jeff and I donned our white beekeeping suits, Jeff reassured me that there was no reason to fear the thousands of bees we were about to encounter. During our hour long look through the hives, not one bee bothered us, the bees just busily buzzed as if someone had not taken the roof of their hive.</p>
</div>
<p class="description">blockquote</p>
<div class="blockquote">
<!-- Quote from Rebecca by Daphne du Maurier -->
<blockquote>“Last year was our inaugural event, so we capped the numbers at a manageable number [at 500]. We sold out a few weeks before race day and raised over $20,000,” said Monster Milers Founder, Carrie Maria. “This year we hope to double in size, which will mean even more exposure for the homeless pets and local animal shelters.”</blockquote>
</div>
<p class="description">meta data</p>
<div class="metadata">
<p>By <a href="#">Leslie Hudson</a> on March 19, 2016 | <a class="category" href="#">Event Planning</a></p>
</div>
<p class="description">form style</p>
<div class="form-style">
<form action="#">
<input type="text" name="firstname" placeholder="Sign up for the newsletter">
<input type="submit" value="Submit">
</form>
</div>
<p class="description">link styles</p>
<div class="links">
<p>Here is an example of a sentence with <a href="#">a link section</a> in the middle.</p>
<p>Here is a single <a href="#">word</a> link in a sentence.</p>
<a href="#">Here is an example of a link not wrapped in a paragraph</a>
</div>
<p class="description">button styles</p>
<div class="buttonstyle">
<br />
<a href="#" class="button">Let's get started</a>
<br />
<a href="#" class="button-2">Connect With Me</a>
<br />
<a href="#" class="button-3">Learn more</a>
<br />
</div>
<p class="description">image styles</p>
<div class="image-layout">
<div class="frame"></div>
<img class="about" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/167497/leslie_hudson_image.jpg" />
</div>
</div>
.style-tile {
display: block;
max-width: 1010px;
margin: auto;
padding-bottom: 50px;
}
body {
font-family: 'Source Sans Pro', sans-serif;
background: #efeeed;
}
.description {
width: 320px;
padding-left: 10px;
color: #d6cfc4;
font-family: 'Times New Roman', Times, serif;
font-size: 0.8em;
font-style: italic;
text-align: left;
line-height: 2em;
}
.type {
font-family: serif;
font-size: 0.8em;
margin-left: 0px;
margin-bottom: -20px;
font-style: italic;
color: #aa9e7e;
}
.logo {
text-align: center;
}
.logo img{
max-width: 100px;
width: 100%;
}
.colors ul {
text-align: center;
list-style: none;
}
.colors ul li {
display: inline-block;
width: 100px;
height: 100px;
margin: 25px;
border-radius: 100px;
}
.colors span {
position: relative;
top: 35px;
color: #FFFFFF;
font-size: 10px;
font-family: Arial, sans-serif;
opacity: 0;
}
.color-1 {
background: #4e4e4e;
}
.color-2 {
background: #7c7c7c;
}
.color-3 {
background: #aa9e7e;
}
.color-4 {
background: #d6cfc4;
}
.color-5 {
background: #244145;
}
.color-5-text {
background: #41767d;
}
.color-6 {
background: #a9c3c0;
}
.color-7 {
background: #562d49;
}
.color-7-text {
background: #6e395d;
}
.color-8 {
background: #a293a3;
}
.color-9 {
background: #efeeed;
border: 1px solid #ffffff;
}
.typography {
margin: 10px;
}
h1 {
margin: 30px auto;
font-family: 'Montserrat', Arial, sans-serif;
font-weight: 400;
font-size: 30px;
line-height: 50px;
letter-spacing: 1.5px;
text-transform: uppercase;
}
h2 {
margin: 30px auto;
font-family: 'Sacramento', Georgia, serif;
font-size: 40px;
font-weight: 400;
line-height: 46px;
letter-spacing: 2px;
}
h3 {
margin: 30px auto;
font-family: 'Montserrat', Arial, sans-serif;
text-transform: uppercase;
font-size: 24px;
letter-spacing: 0.8px;
font-weight: 400;
line-height: 34px;
}
h4 {
margin: 30px auto;
color: #a9c3c0;
font-family: 'Montserrat', Arial, sans-serif;
font-size: 20px;
letter-spacing: 0.8px;
font-weight: 400;
text-transform: uppercase;
line-height: 30px;
}
.copy {
padding: 10px 50px;
}
p {
color: #212121;
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 16px;
line-height: 26px;
letter-spacing: 0.05px;
}
a {
color: #a293a3;
text-decoration: underline;
}
a:hover {
color: #562d49;
}
::selection {
color: #562d49;
background: #efeeed; /* WebKit/Blink Browsers */
}
::-moz-selection {
color: #562d49;
background: #efeeed; /* Gecko Browsers */
}
.blockquote {
padding: 0 50px;
}
blockquote {
color: #212121;
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 16px;
line-height: 26px;
letter-spacing: 0.05px;
background: #ffffff;
padding: 30px 40px;
border: 2px dashed #a9c3c0;
}
.metadata p,
.metadata a {
font-size: 12px;
letter-spacing: 0.5px;
text-transform: uppercase;
text-decoration: none;
}
.category {
color: #aa9e7e;
}
.handwriting, .metadata, .fineprint, .links, .buttonstyle {
margin-left: 50px;
}
form {
margin: auto;
width: 100%;
max-width: 550px;
}
input[type="text"],
input[type="submit"]
{
font-family: 'Montserrat', Arial, sans-serif;
text-transform: uppercase;
letter-spacing: 1.2px;
font-size: 14px;
font-weight: 600;
text-align: center;
}
input[type="text"] {
border: 1px solid #ffffff;
background: #ffffff;
padding: 20px;
max-width: 350px;
width: 80%;
}
input[type="submit"] {
border: 2px solid #a9c3c0;
background: #a9c3c0;
padding: 20px;
max-width: 200px;
width: 20%;
color: white;
}
input[type="submit"]:hover {
color: #a9c3c0;
cursor: pointer;
border: 2px solid #a9c3c0;
background: #efeeed;
}
::-webkit-input-placeholder {
color: #7c7c7c;
}
:-moz-placeholder { /* Firefox 18- */
color: #7c7c7c;
}
::-moz-placeholder { /* Firefox 19+ */
color: #7c7c7c;
}
:-ms-input-placeholder {
color: #7c7c7c;
}
input:focus::-webkit-input-placeholder { color:transparent; }
input:focus:-moz-placeholder { color:transparent;} /* FF 4-18 */
input:focus::-moz-placeholder { color:transparent;} /* FF 19+ */
input:focus:-ms-input-placeholder { color:transparent;} /* IE 10+ */
input:focus {
outline: 0;
background:
}
.button {
display: block;
width: 100%;
max-width: 500px;
padding: 20px 25px;
color: #ffffff;
font-family: 'Montserrat', Arial, sans-serif;
font-size: 18px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
letter-spacing: 1px;
background: #a9c3c0;
}
.button:hover {
color: #a9c3c0;
background: #ffffff;
}
.button-2 {
display: block;
width: 100%;
max-width: 500px;
padding: 20px 25px;
color: #ffffff;
font-family: 'Montserrat', Arial, sans-serif;
font-size: 18px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
letter-spacing: 1px;
border: 2px solid #aa9e7e;
background: #aa9e7e;
}
.button-2:hover {
color: #aa9e7e;
border: 2px solid #aa9e7e;
background: #efeeed;
}
.button-3 {
font-size: 18px;
letter-spacing: 1px;
text-transform: uppercase;
}
.image-layout {
position: relative;
top: 50px;
}
.frame {
position: absolute;
z-index: 5;
top: -20px;
opacity: 0.5;
width: 100%;
max-width: 280px;
height: 280px;
border: 50px solid #d6cfc4;
}
img.about {
width: 100%;
max-width: 320px;
margin: 10px 30px;
}
$(document).ready(function(){
$(".colors ul li").hover(function(){
$("span").css("opacity", "1");
}, function(){
$("span").css("opacity", "0");
});
});
Also see: Tab Triggers