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.
<header>
<h1>Sweet button, dude...</h1>
<h2>I bet you can't click just once.</h2>
<div class="btn-multi">
<input type="checkbox" id="multi-btn" name="multi-btn" />
<label for="multi-btn">
<a href="https://www.facebook.com/" class="btn btn-circle" target="_blank"><i class="fa fa-facebook icon" aria-hidden="true"></i></a>
<a href="https://www.twitter.com/" class="btn btn-circle" target="_blank"><i class="fa fa-twitter icon" aria-hidden="true"></i></a>
<a href="https://www.google.com/" class="btn btn-circle" target="_blank"><i class="fa fa-google-plus icon" aria-hidden="true"></i></a>
<span class="btn btn-circle"><i class="material-icons icon">close</i></span>
<i class="material-icons icon">share</i>
</label>
</div>
</header>
<main>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id sodales purus, a tempor mi. Nullam ac laoreet tortor. Vivamus ut congue neque, id rhoncus libero. Phasellus et accumsan diam. Pellentesque interdum urna eros, in venenatis lorem tincidunt
a. Pellentesque euismod velit sed nunc consectetur vulputate. Sed posuere est id convallis elementum. Phasellus accumsan iaculis est, eu auctor purus mattis non. Phasellus pharetra ex ac lacus ullamcorper, eget tempus augue hendrerit. Vestibulum vitae
lorem augue. Maecenas consectetur tempor turpis, nec imperdiet libero blandit ac. Mauris dignissim purus eu euismod mattis.</p>
<p>Nulla eu condimentum eros. Curabitur vel metus in magna fringilla congue. Cras ac dictum lectus, vitae imperdiet libero. Mauris et neque nibh. Etiam auctor urna purus, in consectetur enim fermentum eget. Vivamus tincidunt massa sapien, sed fermentum
lectus laoreet sed. Donec porttitor lacus sit amet metus facilisis, ac pretium magna venenatis. Ut libero nisi, volutpat id auctor at, congue in dui. Integer turpis sapien, cursus eu magna vel, posuere bibendum sapien.</p>
<p>Nulla accumsan leo quis volutpat rhoncus. Integer nec porttitor ante, quis pharetra ipsum. Vivamus nulla nunc, commodo at commodo vel, placerat quis orci. Phasellus porta, purus vel ornare luctus, lorem nunc molestie nisi, sed fermentum purus nulla vel
est. Nullam purus velit, vestibulum non velit sit amet, elementum auctor mauris. In non lobortis tellus. Maecenas fringilla, turpis eget luctus aliquam, sem ligula varius magna, sit amet dignissim tellus erat non neque. Fusce dignissim ipsum sed orci
aliquam, a molestie magna egestas. In hac habitasse platea dictumst. Curabitur vel rhoncus elit, quis vulputate augue. Pellentesque ac pellentesque diam, eu feugiat velit. In sagittis ipsum eu velit malesuada, sed iaculis dui euismod. Vestibulum tempus
metus et mollis posuere. Etiam lacinia, tellus vitae porttitor vulputate, neque purus rutrum lorem, non vehicula metus augue eu elit. Integer quis turpis quis justo molestie ultricies nec semper enim. In hac habitasse platea dictumst.</p>
</main>
body {
margin: 0;
}
h1 {
padding: 0;
margin: 0;
color: white;
font-weight: lighter;
font-family: 'Open sans', sans-serif;
left: 15%;
top: 50px;
font-size: 2.5em;
position: absolute;
}
h2 {
font-family: 'open sans', sans-serif;
font-weight: lighter;
color: #fff;
opacity: .5;
position: absolute;
left: 15%;
top: 90px;
}
header {
position: relative;
width: 100%;
height: 200px;
background-color: rgba(63,81,181,1);
.btn-multi {
position: absolute;
z-index: 999;
right: 15%;
bottom: -54px;
}
}
.btn {
display: inline-flex;
font-family: 'Roboto', sans-serif;
text-decoration: none;
justify-content: center;
align-items: center;
text-align: center;
cursor: pointer;
white-space: nowrap;
padding: 8px 20px;
font-size: 14px;
background-color: #E91E63;
border-radius: 2px;
color: white;
text-transform: uppercase;
border: none;
transition: all 0.2s ease-in;
background-position: 50%;
outline: none !important;
&.btn-circle {
height: 50px;
width: 50px;
border-radius: 50%;
padding: 0 !important;
font-size: 18px;
}
}
.btn-multi {
input {
display: none;
&:not(:checked) {
~ label {
transform: rotate(0);
.btn {
border-radius: 0;
height: 30px;
width: 30px;
box-shadow: none;
&:first-child {
border-top-left-radius: 100%;
transform: translate(25px, 25px);
}
&:nth-child(2) {
border-top-right-radius: 100%;
transform: translate(55px, 25px);
}
&:nth-child(3) {
border-bottom-left-radius: 100%;
transform: translate(25px, 55px);
}
&:nth-child(4) {
border-bottom-right-radius: 100%;
transform: translate(55px, 55px);
}
.icon { opacity: 0; }
}
> .icon { opacity: 1; cursor: pointer; }
}
}
}
label {
position: relative;
height: 110px;
width: 110px;
display: block;
transform: rotate(45deg);
transition: all .2s ease-in;
cursor: default;
border-radius: 30px;
.btn {
position: absolute;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
&:nth-child(2) { transform: translate(60px, 0); }
&:nth-child(3) { transform: translate(0, 60px); }
&:nth-child(4) { transform: translate(60px, 60px); }
.icon {
opacity: 1;
transition: all .15s ease-in-out;
transform: rotate(-45deg);
}
}
> .icon {
color: white;
position: absolute;
border-radius: 50%;
display: flex;
font-size: 30px;
align-items: center;
justify-content: center;
height: 60px;
width: 60px;
top: 25px;
left: 25px;
opacity: 0;
transition: all .25s ease-in-out;
}
.icon {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
}
}
main {
position: absolute;
left: 15%;
right: 15%;
top: 250px;
margin-bottom: 50px;
font-family: 'open sans', sans-serif;
font-weight: lighter;
}
Also see: Tab Triggers