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.
<link href='https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic' rel='stylesheet' type='text/css'>
<h1>Codepen style shaking save reminder</h1>
<h4>Edit the text in the text area</h4>
<div class="visedit">
<div class="visedit-header">
<button class="save">Save</button>
<h2>Enter Product Description</h2>
</div>
<textarea id="txt1" class="visedit-area">
The Ubuntu Font Family are a set of matching new libre/open fonts in development during 2010-2011. The development is being funded by Canonical Ltd on behalf the wider Free Software community and the Ubuntu project. The technical font design work and implementation is being undertaken by Dalton Maag.
Both the final font Truetype/OpenType files and the design files used to produce the font family are distributed under an open licence and you are expressly encouraged to experiment, modify, share and improve.
The new Ubuntu Font Family was started to enable the personality of Ubuntu to be seen and felt in every menu, button and dialog. The typeface is sans-serif, uses OpenType features and is manually hinted for clarity on desktop and mobile computing screens.
The scope of the Ubuntu Font Family includes all the languages used by the various Ubuntu users around the world in tune with Ubuntu's philosophy which states that every user should be able to use their software in the language of their choice. So the Ubuntu Font Family project will be extended to cover many more written languages.
</textarea>
</div>
<h4>On a side note: I could not get animation-delay: to work on line 70 of the CSS, any thoughts?<br /><br />I am including -prefix-free and have not overwritten it with shorthand. I am stumped.</h4>
html,body{
margin: 0px;
padding: 0px;
background: #EEEEEE;
}
h1{
color: #2c3e50;
font-family: 'Ubuntu', sans-serif;
font-weight: 300;
font-size: 32px;
text-align: center;
margin: 50px 0px 7px 0px;
}
h4{
color: #2c3e50;
font-family: 'Ubuntu', sans-serif;
font-weight: 300;
font-size: 16px;
text-align: center;
margin: 0px 0px 30px 0px;
}
.visedit{
width: 640px;
box-sizing: border-box;
margin: 10px auto;
}
.visedit-header{
width: 100%;
height: 40px;
box-sizing: border-box;
padding-left: 10px;
font-family: 'Ubuntu', sans-serif;
font-weight: 300;
font-size: 14px;
line-height: 30px;
background: #2c3e50;
color: white;
}
h2{
margin: 0px;
padding: 0px;
line-height: 40px;
font-size: 18px;
font-weight: 300;
}
.save{
float: right;
margin: 0px;
border-radius: 0px;
line-height: 40px;
border: 0px;
background: #2ecc71;
color: white;
font-family: 'Ubuntu', sans-serif;
font-weight: 300;
font-size: 14px;
padding: 0px 20px;
}
.shake{
animation-name: shake;
animation-iteration-count: infinite;
animation-duration: 3s;
animation-delay: 2s; /* This is not working cant figure it out. Thoughts in comments? */
}
.visedit-area{
padding: 10px;
box-sizing: border-box;
margin: 0px 0px 70px 0px;
width: 100%;
max-width: 100%;
min-height: 200px;
font-family: 'Ubuntu', sans-serif;
font-weight: 300;
font-size: 14px;
line-height: 20px;
border: 1px solid #2c3e50;
border-top: 0px;
}
@keyframes shake{
0%{
transform: translate(0px, 0px);
}
5%{
transform: translate(5px, 0px);
}
10%{
transform: translate(-5px, 0px);
}
15%{
transform: translate(5px, 0px);
}
20%{
transform: translate(-5px, 0px);
}
25%{
transform: translate(5px, 0px);
}
30%{
transform: translate(-5px, 0px);
}
35%{
transform: translate(5px, 0px);
}
40%{
transform: translate(-5px, 0px);
}
45%{
transform: translate(5px, 0px);
}
50%{
transform: translate(0px, 0px);
}
100%{
transform: translate(0px, 0px);
}
}
$("#txt1").keydown(function (){
$(".save").addClass("shake");
});
$(".save").click(function(){
$(".save").removeClass("shake");
})
Also see: Tab Triggers