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.
#flipMe
span Click for flippin' good times!
.flip
.front#website
.container
h1 Im a totally normal website
p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
p Trimmed driving gloves andrew weatherall dick dastardly knavish rogue what a bounder. Decathlon champion fu manchu hairy lipsum face broom bogie basket man of the year 1986 lady magnets east european?
p Socially mobile clive dunn walrus smashing good fun rock n roll star musketeer? Tudor philosopher rock n roll star brandy mark lawrenson, boxing champion tudor philosopher mark lawrenson crumb catcher brandy dis rock n roll star, dis helllloooo consectetur gentleman crumb catcher rock n roll star fu manchu boxing champion tudor philosopher brandy mark lawrenson.
img(src="https://source.unsplash.com/random/300×200", width="300")
p Lemmy glorious facial hair brush zap rowsdower comb terry thomas country baron? Goose brush nefarious musketeer Daniel plainview grooming hold steady keyboardist, brush tudor philosopher great dictator goose freestyle hold steady keyboardist handsome musketeer 118 118 grooming Daniel plainview Daniel plainview hello, we’re cockneys nefarious class definer, 118 118 hold steady keyboardist brush tudor philosopher by jingo. decathlon champion brush old west sheriff grooming Daniel plainview musketeer freestyle freestyle class definer hello, we’re cockneys goose great dictator handsome nefarious Daniel plainview?
p Boogie nights French café patron cardinal richelieu timothy dalton, timothy dalton toothbrush cardinal richelieu French café patron musketeer joseph stalin boogie nights spaghetti western, cardinal richelieu timothy dalton toothbrush joseph stalin French café patron groomed boogie nights musketeer off-piste lipwig spaghetti western funny walk. Waxy gurn casual style country baron et sodales cum circus strongman.
h3 Funny walk lady magnets lemmy.
p Rock n roll star sam elliott toothbrush, groucho marx toothbrush rock n roll star facial accessory will you do the fandango toothbrush Fallen eyebrow sam elliott.
img(src="https://source.unsplash.com/random/200×200", width="200")
p Alpha trion will you do the fandango mouth coiffure mr frothy-top man of the year 1986 tip top old bean. Andrew weatherall basil fawlty toothbrush frightfully nice brush helllloooo gunslinger old west sheriff, great dictator old west sheriff helllloooo gunslinger brush magnum pi frightfully nice godlike toothbrush id andrew weatherall basil fawlty?
p Hair trimmer dick van dyke tip top old bean will you do the fandango movember jolly good show casual style cappuccino catcher, hair trimmer caterpillar movember freestyle will you do the fandango tip top old bean cigars facial accessory hairy kiss. jolly good show casual style cappuccino catcher lip warmer dick van dyke?
p Fallen eyebrow driving gloves will you do the fandango ron jeremy cappuccino collector gunslinger?
p Lemmy glorious facial hair brush zap rowsdower comb terry thomas country baron? Goose brush nefarious musketeer Daniel plainview grooming hold steady keyboardist, brush tudor philosopher great dictator goose freestyle hold steady keyboardist handsome musketeer 118 118 grooming Daniel plainview Daniel plainview hello, we’re cockneys nefarious class definer, 118 118 hold steady keyboardist brush tudor philosopher by jingo. decathlon champion brush old west sheriff grooming Daniel plainview musketeer freestyle freestyle class definer hello, we’re cockneys goose great dictator handsome nefarious Daniel plainview?
.back#hiddenEaster
.page
.container
h1 I hide behind your websites and chuckle mildly at your Inadequacies!
p Muhaha! haha! ha! LOLZ!
img(src="https://i.pinimg.com/564x/ef/2b/83/ef2b8370ba7bc906f6956c1b9a51df4e.jpg")
/*FLIPPING STYLES*/
$speed:1s;
$perspective:1000px;
body {
-webkit-perspective: $perspective;
perspective: $perspective;
}
.flip {
width:100%;
height:100%;
position:relative;
z-index:0;
-webkit-perspective: $perspective;
perspective: $perspective;
.front,
.back {
transform:translate3d(0,0,0);
-webkit-transform:translate3d(0,0,0);
-webkit-backface-visibility:hidden;
backface-visibility:hidden;
-webkit-perspective:$perspective;
perspective:$perspective;
-webkit-transition:$speed;
transition:$speed;
-webkit-transform-style:preserve-3d;
transform-style:preserve-3d;
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
overflow:auto;
-webkit-overflow-scrolling: touch;
overflow-scrolling: touch;
}
.front {
-webkit-transform:rotateY(0deg);
transform:rotateY(0deg);
z-index:2;
}
.back {
-webkit-transform:rotateY(-179deg);
transform:rotateY(-179deg);
z-index:1;
}
//when flipped
&.flipped {
.front {
-webkit-transform:rotateY(180deg);
transform:rotateY(180deg);
z-index:1;
}
.back {
-webkit-transform:rotateY(0deg);
transform:rotateY(0deg);
z-index:2;
}
}
}
/*GENERAL STYLES*/
body,html {
background:#000;
height:100%;
font-family:"lato",Arial,Helvetica,sans-serif;
font-weight:300;
line-height:1.3em;
overflow:hidden;
}
body {
background:url("https://camo.githubusercontent.com/2866b792051437ca694bf0648288ad55ab66d883/68747470733a2f2f7261772e6769746875622e636f6d2f6875676f66657272656972612f677265617465722d6d6f6e6f6b61692f6d61737465722f73637265656e73686f742d64617263756c612e706e67") no-repeat center center;
background-size:cover;
box-shadow:0px 0px 500px #000 inset;
}
h1,h2,h3,h4,h5,h6 {
font-weight:400;
text-transform:uppercase;
font-family:"oswald",Arial,Helvetica,sans-serif;
line-height:1.3em;
}
.container {
width:80%;
max-width:960px;
margin:50px auto;
}
#flipMe {
position:absolute;
top:-60px;
left:-120px;
cursor:pointer;
background:#F5BB4A;
color:#333;
z-index:10;
-webkit-transform:rotate(-45deg);
transform:rotate(-45deg);
text-align:center;
box-shadow:10px 10px 5px rgba(0,0,0,0.1);
font-family:"oswald",Arial,Helvetica,sans-serif;
font-weight:400;
text-transform:uppercase;
transition:all 0.5s;
text-shadow:0px 1px rgba(255,255,255,0.5);
&:hover {
background:#FFAE19;
}
span {
padding:100px 100px 20px 100px;
width:100px;
display:block;
}
}
#website {
background:#fff;
img {
float:left;
margin:0 20px 10px 0;
}
img:nth-child(2n){
float:right;
margin:0 0 10px 20px;
}
}
#hiddenEaster {
background:#FF4949;
color:#fff;
img {
width:100%;
height:auto;
max-width:100%;
}
}
//on doc ready
$(document).ready(function(){
flipper();
});
//the flipper js helper
function flipper(){
//grab the els we need
var trigger = $("#flipMe");
var flip = $(".flip");
var sides = flip.find(".front,.back");
//sniff for IE
var msie = (/Trident\/7\./).test(navigator.userAgent);
//work out the duration of the animation in ms (used in the ie fix)
var duration = sides.css("transition-duration") || "30s";
duration = parseInt(duration)*1000;
//on click of trigger
trigger.on("click",function(){
//toggle flipped class to trigger css animation
flip.toggleClass("flipped");
//change the text in the button
if(flip.hasClass("flipped")){
trigger.find("span").text("I cower at your goaty waddles!");
}else{
trigger.find("span").text("Click for flippin' good times!");
}
//IE FIX
//having overflow or perspective on the flipped elements breaks backface visibility in ie.
//We want to keep perspective so we remove the overflow of the els during the animation
if(msie){
sides.css("overflow","hidden");
setTimeout(function(){
sides.css("overflow","");
},duration);
}
});
}
Also see: Tab Triggers