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.
<section class="clearfix">
<h2>Inline Updates <small>(without updates)</small></h2>
<p class="description">Inline Updates replaces progress updates with a simpler and more straight forward experience when installing, updating, and deleting plugins and themes.</p>
<table class="animation-table">
<tbody>
<tr class="tr-hello">
<td>
<p class="description-hello">
<strong>Hello Dolly</strong>
You have version 1.5 installed. Update to 1.6. <a href="" class="thickbox open-plugin-details-modal" aria-label="View Hello Dolly version 1.6 details">View version 1.6 details.</a></p>
<div class="notice-hello">
<span class="dashicons dashicons-update icon-hello"></span>
<p class="newversion-hello">There is a new version of Hello Dolly available. <a href="" aria-label="View Hello Dolly version 1.6 details">View version 1.6 details</a> or <a href="" aria-label="Update Hello Dolly now" class="update-hello">update now</a>.</p>
</div>
</td>
</tr>
<tr class="tr-2015">
<td>
<p class="description-2015">
<strong>Twenty Fifteen</strong>
You have version 1.4 installed. Update to 1.5.</p>
<div class="notice-2015">
<span class="dashicons dashicons-update icon-2015"></span>
<p class="newversion-2015">There is a new version of Twenty Fifteen available. <a href="" aria-label="View Hello Dolly version 1.6 details">View version 1.5 details</a> or <a href="" aria-label="Update Hello Dolly now" class="update-2015">update now</a>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section class="clearfix">
<h2>Inline Updates <small>(with updates)</small></h2>
<p class="description">Inline Updates replaces progress updates with a simpler and more straight forward experience when installing, updating, and deleting plugins and themes.<br /><br />
Try out this feature with your pending updates below.</p>
<table>
<tbody>
<tr>
<td>
<p>
<strong>Hello Dolly</strong>
You have version 1.4 installed. Update to 1.6. <a href="" class="thickbox open-plugin-details-modal" aria-label="View Hello Dolly version 1.6 details">View version 1.6 details.</a><br>Compatibility with WordPress 4.6: Unknown </p>
<div class="notice">
<p class="icon-pseudo">There is a new version of Hello Dolly available. <a href="" aria-label="View Hello Dolly version 1.6 details">View version 1.6 details</a> or <a href="" aria-label="Update Hello Dolly now">update now</a>.</p>
</div>
</td>
</tr>
<tr>
<td>
<p>
<strong>Twenty Fifteen</strong>
You have version 1.4 installed. Update to 1.5.</p>
<div class="notice">
<p class="icon-pseudo">There is a new version of Twenty Fifteen available. <a href="" aria-label="View Hello Dolly version 1.6 details">View version 1.5 details</a> or <a href="" aria-label="Update Hello Dolly now">update now</a>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section class="clearfix">
<h2>Inline Updates <small>(no updates)</small></h2>
<div>
<div class="gif">gif</div>
</div>
<div>
<h3>Install, Update, and Delete</h3>
<p>Inline Updates replaces progress updates with a simpler and more straight forward experience when installing, updating, and deleting plugins and themes.</p>
</div>
</section>
html, body {
background: #f1f1f1;
color: #444;
font-size: 100%;
font-family:
/* 1 */ -apple-system, BlinkMacSystemFont,
/* 2 */ "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
/* 3 */ "Helvetica Neue", sans-serif;
}
.tr-hello, .tr-2015 {
display: none;
}
@keyframes clicked {
from { opacity: 0; }
to { opacity: 1; }
}
.clicked {
-moz-animation: clicked 1s;
animation: clicked 1s;
}
.notice-updating {
-moz-animation: rotation 2s infinite linear;
animation: rotation 2s infinite linear;
}
@keyframes rotation {
from {
-moz-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-moz-transform: rotate(359deg);
transform: rotate(359deg);
}
}
section {
position: relative;
margin: 25px 40px 0 20px;
max-width: 1050px;
font-size: 15px;
padding-bottom: 200px;
margin-bottom: 200px;
border-bottom: 1px solid rgba(0,0,0,.1);
&:last-child {
border-bottom: none;
margin-bottom: 0;
}
> div {
float: left;
width: 48%;
margin-right: 4%;
&:last-child {
margin-right: 0;
}
}
p {
margin-top: .6em 0 1em;
line-height: 1.6em;
&.description {
max-width: 600px;
margin: 0 auto;
text-align: center;
margin-bottom: 2.5em;
}
}
}
h2 {
margin: 50px 0 1em;
font-size: 1.8em;
line-height: 1.3;
font-weight: 300;
text-align: center;
small {
font-size: 14px;
color: #ccc;
display: block;
}
}
h3 {
margin: 4em 0 .6em;
font-size: 1.25em;
line-height: 1.5em;
font-weight: 600;
color: #23282d;
}
hr {
border: 0;
height: 0;
margin: 0;
border-top: 1px solid rgba(0,0,0,.1);
}
table {
border-spacing: 0;
width: 100%;
clear: both;
margin: 0;
border: 1px solid #e5e5e5;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
box-shadow: 0 1px 1px rgba(0,0,0,.04);
background: #fff;
thead > tr > td {
padding: 8px 10px 8px 30px;
vertical-align: middle;
line-height: 1.4;
font-size: 14px;
border-bottom: 1px solid #e1e1e1;
text-align: center;
}
tbody > tr > td {
adding-right: 12px;
white-space: nowrap;
font-size: 13px;
line-height: 1.5em;
vertical-align: top;
padding: 8px 10px 8px 30px;
border-bottom: 1px solid #e1e1e1;
}
strong {
display: block;
margin-bottom: .2em;
font-size: 14px;
}
}
.notice, .notice-hello, .notice-2015 {
margin: 5px 20px 15px 0px;
background-color: #fff8e5;
border-left: 4px solid #ffb900;
padding: 1px 12px;
color: #000;
font-size: 13px;
line-height: 1.5em;
p {
margin: .5em 0;
display: inline-block;
}
p.icon-pseudo:before {
margin-right: 6px;
vertical-align: bottom;
color: #f56e28;
display: inline-block;
content: "\f463";
font: 400 20px/1 dashicons;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
&.success {
background-color: #ecf7ed;
border-left-color: #46b450;
}
}
.dashicons-update, .dashicons-yes {
margin-right: 6px;
color: #f56e28;
display: inline-block;
font: 400 20px/1 dashicons;
vertical-align: middle;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.dashicons-yes {
color: #79ba49;
}
a {
color: #0073aa;
text-decoration: none;
&:hover, &.hover {
color: #00a0d2;
}
}
.gif {
width: 100%;
height: 300px;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
color: #aaa;
}
/* slightly enhanced, universal clearfix hack */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
/* start commented backslash hack \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* close commented backslash hack */
var animateUpdates = function(){
$('.tr-hello').fadeIn(600, function() {
$('.tr-2015').fadeIn(600).delay(1000);
});
setTimeout(function() {
$('.update-hello').addClass('hover clicked')
$('.dashicons-update.icon-hello').addClass('notice-updating');
$('.newversion-hello').replaceWith('<p class="newversion-hello">Updating...</p>');
setTimeout(function() {
$('.dashicons-update.icon-hello').removeClass('notice-updating dashicons-update').addClass('dashicons-yes');
$('.newversion-hello').replaceWith('<p>Updated!</p>');
$('.notice-hello').addClass('success');
$('.description-hello').replaceWith('<p><strong>Hello Dolly</strong> You have version 1.6 installed.</p>');
}, 3000);
}, 2000);
setTimeout(function() {
$('.update-2015').addClass('hover clicked')
$('.dashicons-update.icon-2015').addClass('notice-updating');
$('.newversion-2015').replaceWith('<p class="newversion-2015">Updating...</p>');
setTimeout(function() {
$('.dashicons-update.icon-2015').removeClass('notice-updating dashicons-update').addClass('dashicons-yes');
$('.newversion-2015').replaceWith('<p>Updated!</p>');
$('.notice-2015').addClass('success');
$('.description-2015').replaceWith('<p><strong>Twenty Fifteen</strong> You have version 1.5 installed.</p>');
}, 1500);
}, 4000);
};
$(document).ready( animateUpdates );
Also see: Tab Triggers