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.
<h1>Pure CSS3 arrow icons</h1>
<div style="float:left">
<span class="arrow arrow-up"></span>
<span class="arrow arrow-right"></span>
<span class="arrow arrow-down"></span>
<span class="arrow arrow-left"></span>
<br>
<span class="arrow arrow-up curve-right"><span class="curve"></span></span>
<span class="arrow arrow-right curve-right"><span class="curve"></span></span>
<span class="arrow arrow-down curve-right"><span class="curve"></span></span>
<span class="arrow arrow-left curve-right"><span class="curve"></span></span>
<br>
<span class="arrow arrow-up curve-left"><span class="curve"></span></span>
<span class="arrow arrow-right curve-left"><span class="curve"></span></span>
<span class="arrow arrow-down curve-left"><span class="curve"></span></span>
<span class="arrow arrow-left curve-left"><span class="curve"></span></span>
</div>
<div style="float:left">
<span class="arrow arrow-animate">
<span class="arrow-item"><span class="curve"></span></span>
<i></i>
<span class="arrow-item"><span class="curve"></span></span>
</span>
</div>
@import "compass/css3";
// * * * VARIABLES * * *
// width of the arrow (icon)
$w : 40px;
// height of the arrow (icon)
$h : $w;
// color of the arrow (icon)
$c : #555;
// * * * MIXINS * * *
// body
@mixin body( $width , $height , $top , $left ){
border: none;
background-color: $c;
height: $height;
width: $width;
top: $top;
left: $left;
}
@mixin clearBody{
border: none;
width: 0;
height: 0;
}
// arrow
@mixin arrow( $width , $height , $top , $left, $way){
left: $left;
top: $top;
border-width:$height $width;
border-#{$way}-color:$c;
}
// bodyCurve
@mixin bodyCurve( $width , $height, $top , $left, $border ,$btop ,$bleft){
height: $height;
width: $width;
top: $top;
left: $left;
&:before{
@include border-radius(2000px);
border:$border solid $c;
height: $height*2 -$border*2;
width: $width*2 -$border*2;
top: $btop;
left:$bleft;
}
}
// * * * GENERAL CSS * * *
body{
padding:50px 100px;
background: #FEC;
color:#CB9;
font-family: Tahoma,Arial,sans-serif;
}
h1,h2{
font-weight: 300;
}
.arrow{
width: $w;
height: $h;
position: relative;
display: inline-block;
margin: $h/4 $w/4;
//border:1px solid #EDB;
&:before,
&:after{
content:'';
border-color:transparent;
border-style:solid;
position: absolute;
}
.curve{
position: absolute;
overflow: hidden;
&:before{
content:'';
position:absolute;
}
}
}
// * * * ARROWS * * *
// arrow-up
.arrow-up{
&:before{ @include body(30%,50%,50%,50% - 30%/2); }
&:after { @include arrow($w/2,$h/2,-50%,0,bottom); }
}
// arrow-right
.arrow-right{
&:before{ @include body(50%,30%,50% - 30%/2,0); }
&:after { @include arrow($w/2,$h/2,0,50%,left); }
}
// arrow-down
.arrow-down{
&:before{ @include body(30%,50%,0,50% - 30%/2); }
&:after { @include arrow($w/2,$h/2,50%,0,top); }
}
// arrow-left
.arrow-left{
&:before{ @include body(50%,30%,50% - 30%/2,50%); }
&:after { @include arrow($w/2,$h/2,0,-50%,right); }
}
// * * * CURVE RIGHT ARROW * * *
// arrow-up
.arrow-up.curve-right{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.65, $h*.5,
$h*.5, $w*.35,
$w/3.33,
-$w*.5 , 0 );}
}
// arrow-right
.arrow-right.curve-right{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.5, $h*.65,
$h*.35, 0,
$w/3.33,
0, 0 );}
}
// arrow-down
.arrow-down.curve-right{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.65, $h*.5,
0, 0,
$w/3.33,
0 , -$w*.65);}
}
// arrow-left
.arrow-left.curve-right{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.5, $h*.65,
0, $w*.5,
$w/3.33,
-$h*.65, -$w*.5);}
}
// * * * CURVE LEFT ARROW * * *
// arrow-up
.arrow-up.curve-left{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.65, $h*.5,
$h*.5, 0,
$w/3.33,
-$h*.5 , -$w*.65 );}
}
// arrow-right
.arrow-right.curve-left{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.5, $h*.65,
0, 0,
$w/3.33,
-$h*.65, 0 );}
}
// arrow-down
.arrow-down.curve-left{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.65, $h*.5,
0, $w*.35,
$w/3.33,
0 , 0);}
}
// arrow-left
.arrow-left.curve-left{
&:before{@include clearBody;}
.curve{@include bodyCurve(
$w*.5, $h*.65,
$h*.35, $w*.5,
$w/3.33,
0, -$w*.5);}
}
// * * * ARROW ANIMATE * * * (Just for fun)
.arrow-animate{
-webkit-animation: spin 2s infinite linear;
margin-left:$w/2;
$h:$h*3+$h*1.25;
$w:$w*3+$w*1.25;
height: $h;
width: $w;
/*
i{
@include border-radius(2000px);
position: absolute;
top: $h*.115;
left:$h*.115;
width: $w*.57;
height: $h*.57;
border:$h*.1 solid rgba(255,0,0,.5);
z-index: 1000;
}*/
.arrow-item{
width: $w;
height: $h*.5;
position: absolute;
&:before{
content:'';
height: 0;
width: 0;
position: absolute;
border:$h*.18 solid transparent;
}
.curve{
height: $h*.42;
width: $w;
//background-color: rgba(255,0,0,.2);
&:before{
@include border-radius(2000px);
border:$w*.1 solid $c;
height:$h*.57;
width:$w*.57;
left:$w*.115;
}
}
&:first-child{
top:0;
left:0;
&:before{
border-top-color:$c;
bottom: -$h*.18;
}
.curve{
top: 0;
left: 0;
&:before{
top: $h*.115;
}
}
}
&:last-child{
top:$h/2;
left:0;
&:before{
border-bottom-color:$c;
top: -$h*0.2;
right:0;
}
.curve{
bottom: 0;
left: 0;
&:before{
bottom: $h*.115;
}
}
}
}
}
@-webkit-keyframes spin {
0% {@include transform(rotate(0deg));}
100% {@include transform(rotate(-360deg));}
}
Also see: Tab Triggers