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.
<div class="wrap">
<h2>Routing Examples <span>Hover over each one</span></h2>
<div class="colThree colWrap">
<div class="col">
<div class="routing routing-example1">
<div class="iconWrap">
<svg class="icon icon-pencil"><use xlink:href="#icon-pencil"></use></svg>
</div>
<div class="text">
<h3>Box One</h3>
Call to action box with icon interaction
</div>
</div>
</div>
<div class="col">
<div class="routing routing-example2">
<div class="iconWrap">
<svg class="icon icon-cog"><use xlink:href="#icon-cog"></use></svg>
</div>
<div class="text">
<h3>Box Two</h3>
Call to action box with colour and text interaction
</div>
</div>
</div>
<div class="col">
<div class="routing routing-example3">
<div class="iconWrap">
<svg class="icon icon-point-right"><use xlink:href="#icon-point-right"></use></svg>
</div>
<div class="text">
<h3>Box Three</h3>
Call to action box with icon interaction
</div>
</div>
</div>
</div>
</div>
<svg class="baseSVG">
<symbol id="icon-pencil" viewBox="0 0 1024 1024">
<title>pencil</title>
<path class="path1" d="M864 0c88.364 0 160 71.634 160 160 0 36.020-11.91 69.258-32 96l-64 64-224-224 64-64c26.742-20.090 59.978-32 96-32zM64 736l-64 288 288-64 592-592-224-224-592 592zM715.578 363.578l-448 448-55.156-55.156 448-448 55.156 55.156z"></path>
</symbol>
<symbol id="icon-cog" viewBox="0 0 1024 1024">
<title>cog</title>
<path class="path1" d="M933.79 610.25c-53.726-93.054-21.416-212.304 72.152-266.488l-100.626-174.292c-28.75 16.854-62.176 26.518-97.846 26.518-107.536 0-194.708-87.746-194.708-195.99h-201.258c0.266 33.41-8.074 67.282-25.958 98.252-53.724 93.056-173.156 124.702-266.862 70.758l-100.624 174.292c28.97 16.472 54.050 40.588 71.886 71.478 53.638 92.908 21.512 211.92-71.708 266.224l100.626 174.292c28.65-16.696 61.916-26.254 97.4-26.254 107.196 0 194.144 87.192 194.7 194.958h201.254c-0.086-33.074 8.272-66.57 25.966-97.218 53.636-92.906 172.776-124.594 266.414-71.012l100.626-174.29c-28.78-16.466-53.692-40.498-71.434-71.228zM512 719.332c-114.508 0-207.336-92.824-207.336-207.334 0-114.508 92.826-207.334 207.336-207.334 114.508 0 207.332 92.826 207.332 207.334-0.002 114.51-92.824 207.334-207.332 207.334z"></path>
</symbol>
<symbol id="icon-point-right" viewBox="0 0 1024 1024">
<title>point-right</title>
<path class="path1" d="M416 960h160c52.934 0 96-43.066 96-96 0-17.104-4.494-33.176-12.368-47.098 26.664-17.076 44.368-46.958 44.368-80.902 0-24.564-9.276-47.004-24.504-64 15.228-16.996 24.504-39.436 24.504-64 0-11.214-1.934-21.986-5.484-32h229.484c52.934 0 96-43.066 96-96s-43.066-96-96-96h-394.676l93.836-176.018c8.4-14.536 12.84-31.126 12.84-47.982 0-52.934-43.066-96-96-96-26.368 0-50.954 10.472-69.226 29.49-0.238 0.248-0.47 0.496-0.7 0.75l-218.074 239.17v-45.41c0-17.672-14.326-32-32-32h-192c-17.674 0-32 14.328-32 32v640c0 17.674 14.326 32 32 32h192c17.674 0 32-14.326 32-32v-44.222l145.69 72.844c4.444 2.222 9.342 3.378 14.31 3.378zM160 896c-17.674 0-32-14.326-32-32s14.326-32 32-32 32 14.326 32 32-14.326 32-32 32zM423.556 896l-167.556-83.778v-383.824l265.168-290.818c6.066-6.18 14.162-9.58 22.832-9.58 17.644 0 32 14.356 32 32 0 5.46-1.308 10.612-3.894 15.324-0.324 0.53-0.632 1.070-0.926 1.622l-119.418 224c-5.288 9.92-4.986 21.884 0.8 31.52 5.784 9.638 16.198 15.534 27.438 15.534h448c17.644 0 32 14.356 32 32s-14.356 32-32 32h-320c-17.672 0-32 14.326-32 32s14.328 32 32 32c17.644 0 32 14.356 32 32s-14.356 32-32 32c-17.674 0-32 14.326-32 32s14.326 32 32 32c17.644 0 32 14.356 32 32s-14.356 32-32 32h-32c-17.674 0-32 14.326-32 32s14.326 32 32 32c17.644 0 32 14.356 32 32s-14.356 32-32 32h-152.444z"></path>
</symbol>
</svg>
/**
* Routing Boxes
*/
@keyframes scribble{
0% {transform: translate(0, 0) rotate(0deg);}
10% {transform: translate(-1em, 0px) rotate(10deg);}
20% {transform: translate(-0.75em, -0.5em) rotate(8deg);}
30% {transform: translate(-0.5em, 0.5em) rotate(12deg);}
40% {transform: translate(-0.25em, -0.5em) rotate(11deg);}
50% {transform: translate(0, 0.5em) rotate(10deg);}
60% {transform: translate(0.25em, -0.5em) rotate(10deg);}
70% {transform: translate(0.5em, 0.5em) rotate(9deg);}
80% {transform: translate(0.75em, -0.5em) rotate(10deg);}
90% {transform: translate(1em, 0.5em) rotate(11deg);}
100% {transform: translate(0px,0) rotate(0deg);}
}
$point-movement: 0.8em;
$point-angle: 5deg;
@keyframes point {
0% {left: 0; transform: rotate(0deg)}
25% {left: -$point-movement; transform: rotate(-$point-angle)}
75% {left: $point-movement; transform: rotate($point-angle)}
100% {left: 0; transform: rotate(0deg)}
}
.routing {
background: #85d3e1;
padding: 1.5em;
text-align: center;
.iconWrap {
text-align: center;
margin-bottom: 2em;
}
.icon {
width: 6em;
height: 6em;
display: inline-block;
}
&:hover {
cursor: pointer;
}
&-example1 {
.icon {
animation-play-state: paused;
}
&:hover {
.icon {
position: relative;
animation: scribble 1.5s linear infinite;
}
}
}
&-example2 {
transition: color ease 0.3s, background ease 0.3s;
.icon {
transition: fill ease 0.3s, transform ease 0.3s;
}
&:hover {
cursor: pointer;
background: #2E7A88;
color: #fff;
.icon {
fill: #fff;
transform: rotate(60deg);
}
}
}
&-example3 {
border: 0.5em solid #85d3e1;
transition: background 0.3s ease, border 0.3s ease;
.icon {
position: relative;
animation: point 2s linear infinite;
}
&:hover {
border-color: #000;
background: #eee;
.icon {
animation-play-state: paused;
}
}
}
}
Also see: Tab Triggers