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.
<div class="wrapper">
<h1>Button Library - Inputs and Buttons</h1>
<div class="holder">
<div class="title"><h2>@include button_basic();</h2></div>
<div class="container container1">
<input type="submit" class="button" value="The Basic Input">
<button class="button" type="submit">The Basic Button</button>
</div>
</div>
<div class="holder">
<div class="title"><h2>@include button_icon();</h2></div>
<div class="container container2">
<input type="submit" class="button" value="The Icon Slide Input">
<button class="button" type="submit">The Icon Slide Button</button>
</div>
</div>
<div class="holder">
<div class="title"><h2>@include button_3D();</h2></div>
<div class="container container3">
<input type="submit" class="button" value="The 3D Input">
<button class="button" type="submit">The 3D Button</button>
</div>
</div>
<div class="holder">
<div class="title"><h2>@include button_outline();</h2></div>
<div class="container container4">
<input type="submit" class="button" value="The Outlined Input">
<button class="button" type="submit">The Outlined Button</button>
</div>
</div>
<!--
<div class="holder">
<div class="title"><h2>@include button_flat();</h2></div>
<div class="container container5">
<input type="submit" class="button" value="The Flat Input">
<button class="button" type="submit">The Flat Button</button>
</div>
</div> -->
<div class="holder">
<div class="title"><h2>@include button_depth();</h2></div>
<div class="container container6">
<input type="submit" class="button" value="The Depth Input">
<button class="button" type="submit">The Depth Button</button>
</div>
</div>
</div>
@import "compass/css3";
//For Library Display
@import url(https://fonts.googleapis.com/css?family=Lora);
@import url(https://fonts.googleapis.com/css?family=Lato);
$background: #eee;
$lato: 'Lato', sans-serif;
$lora: 'Lora', serif;
$fontColor: #888;
@font-face {
font-family: "SSSymbolicons";
src: url('http://www.astonish.com/wp-content/themes/astonishing_brewer/fonts/icons/ss-symbolicons/ss-symbolicons-block.eot');
src: url('http://www.astonish.com/wp-content/themes/astonishing_brewer/fonts/icons/ss-symbolicons/ss-symbolicons-block.eot?#iefix') format('embedded-opentype'),
url('http://www.astonish.com/wp-content/themes/astonishing_brewer/fonts/icons/ss-symbolicons/ss-symbolicons-block.woff') format('woff'),
url('http://www.astonish.com/wp-content/themes/astonishing_brewer/fonts/icons/ss-symbolicons/ss-symbolicons-block.ttf') format('truetype'),
url('http://www.astonish.com/wp-content/themes/astonishing_brewer/fonts/icons/ss-symbolicons/ss-symbolicons-block.svg#SSSymboliconsBlock') format('svg');
font-weight: normal;
font-style: normal;
}
.wrapper {
width: 1000px;
height: auto;
margin: 0px auto;
color: $fontColor;
h1 {
text-align: center;
font-family: $lato;
margin: 40px 0 25px 0;
display: block;
clear: both;
float: none;
width: 100%;
float: left;
}
.holder {
width: 100%;
float: left;
margin: 20px 0px;
box-shadow: 0px 0px 16px $background;
display: table;
.title {
vertical-align: middle;
width: 37%;
display: table-cell;
}
h2 {
text-align: left;
margin-left: 40px;
font-family: $lato;
font-size: 20px;
}
.container {
width: 100%;
height: auto;
float: right;
text-align: center;
display: table-cell;
}
}
}
// Basic Button Styles
.button {
border: none;
min-height: 35px;
padding: 15px;
min-width: 150px;
font-size: 16px;
cursor: pointer;
margin: 20px;
&:focus {
outline: none;
}
}
@function dynamicColor ( $color ) {
@if lightness($color) < 50% {
@return #f1f1f1;
} @else {
@return #111;
}
}
$colorDefault: #72A410;
$fontDefault: $lato;
$radiusDefault: 0px;
$stageDefault: transparent;
//Mixin Variables (color, font, radius, stage[the background] )
//Button 1 - Basic
@mixin button_basic($color: $colorDefault, $font: $fontDefault, $radius: $radiusDefault){
background: $color;
border: 1px solid darken($color, 10%);
border-radius: $radius;
box-shadow: inset 0 1px 0 lighten($color, 30%);
color: dynamicColor($color);
font-family: $font;
font-size: 16px;
font-weight: normal;
&:hover {
background: darken($color, 10%);
color: dynamicColor(darken($color, 10%));
}
}
//Button 2 - MLC Arrow
@mixin button_icon( $color: $colorDefault, $font: $fontDefault, $radius: 3px, $icon: ''){
border-radius: $radius;
color: dynamicColor($color);
text-shadow: 1px 1px rgba( darken($color, 40%), 0.3);
padding: 12px 18px;
position: relative;
overflow: hidden;
@include box-shadow(0 1px 1px rgba(0,0,0,.20), inset 0 2px rgba(255,255,255,.30));
border: solid 1px darken($color, 13%);
@include background-image (linear-gradient( top, rgba(255,255,255,.30), rgba(255,255,255,0)));
background-color: $color;
@include transition(background-color 300ms);
@if $icon != ''{
padding-right: 40px;
@include transition(padding 300ms);
&:after{
content: $icon;
position: absolute;
top: 11px;
right: 14px;
font-family: "SSSymbolicons";
font-size: 18px;
font-style: normal;
font-weight: normal;
text-decoration: none;
text-rendering: optimizeLegibility;
white-space: nowrap;
-moz-font-feature-settings: "liga=1";
-moz-font-feature-settings: "liga";
-ms-font-feature-settings: "liga" 1;
-o-font-feature-settings: "liga";
font-feature-settings: "liga";
-webkit-font-smoothing: antialiased;
@include transition(right 300ms ease-out);
}
&:hover{
padding-left: 29px;
padding-right: 29px;
&:after{
right: -18px;
}
}
}
&:hover{
@include background-image (linear-gradient( top, rgba(255,255,255,.20), rgba(255,255,255,0)));
background-color: darken($color, 10%);
}
}
//Button 3 - Loiselle
@mixin button_3D($color: $colorDefault, $font: $fontDefault, $radius: 5px){
background-color: $color;
border-radius: $radius;
color: dynamicColor($color);
font-family: $font;
font-weight: bold;
padding: 10px 40px;
text-align: center;
text-decoration: none;
text-shadow: 1px 1px rgba( darken($color, 40%), 0.3);
@include box-shadow(0px 3px rgba(darken($color, 20%),1),
0px 4px rgba(darken($color, 23%),1),
0px 5px rgba(darken($color, 26%),1),
0px 6px rgba(darken($color, 29%),1),
0px 7px rgba(darken($color, 32%),1),
0px 8px rgba(darken($color, 36%),1),
0px 12px 6px -1px rgba(0,0,0,.5),
//inner glow & drop shadow
inset 0 1px 1px rgba(255,255,255,.7), inset 0 0 3px rgba(252,252,252,.6));
border: solid 1px darken($color, 20%);
@include background-image(linear-gradient(to top, rgba(0,0,0,.14), rgba(255,255,255,.14)));
@include transition(transform 100ms, box-shadow 100ms, background-color 200ms, color 200ms);
&:hover{
background-color: darken($color, 10%);
}
&:active{
@include transform(translateY(5px));
@include box-shadow(0px 3px rgba(darken($color, 20%),1),
/* gradient effects */
0px 1px rgba(darken($color, 32%),1),
0px 5px 2px 0px rgba(0,0,0,.4),
//inner glow & drop shadow
inset 0 1px 1px rgba(255,255,255,.7), inset 0 0 3px rgba(252,252,252,.6));
// Proper Shadows
@include box-shadow(
0px 3px rgba(darken($color, 20%),1),
0px 3px rgba(darken($color, 23%),1),
0px 3px rgba(darken($color, 26%),1),
0px 3px rgba(darken($color, 29%),1),
0px 3px rgba(darken($color, 32%),1),
0px 3px rgba(darken($color, 36%),1),
0px 5px 2px 0px rgba(0,0,0,.4),
inset 0 1px 1px rgba(255,255,255,.7),
inset 0 0 3px rgba(252,252,252,.6));
}
}
//Button 4 - Outlined
@mixin button_outline($color: $colorDefault, $font: $fontDefault, $radius: $radiusDefault){
background: none;
border: 3px solid $color;
border-radius: $radius;
color: $color;
font-family: $font;
@include transition(all 300ms);
&:hover {
background: $color;
color: dynamicColor($color);
}
&:active {
background: darken($color, 10%);
color: dynamicColor(darken($color, 10%));
}
}
//Button 5 - Flat
//Button 6 - Depth
@mixin button_depth($color: $colorDefault, $font: $fontDefault, $radius: $radiusDefault) {
color: dynamicColor($color);
$depthBG: linear-gradient(lighten($color, 8%), darken($color, 8%));
$depthBGFlip: linear-gradient(darken($color, 8%), lighten($color, 8%));
$depthBGActive: linear-gradient(darken($color, 12%), lighten($color, 6%));
-moz-background-size: 100%;
background-size: 100%;
background-repeat: repeat-x;
border-radius: $radius;
box-shadow: 0px 3px 6px rgba(0,0,0,.2);
@include background-image($depthBG);
&:hover {
@include background-image($depthBGFlip);
box-shadow: inset 0 0 10px rgba(0,0,0,.2);
text-shadow: 1px 1px 3px rgba(0,0,0,.4);
}
&:active {
@include background-image($depthBGActive);
box-shadow: inset 0 0 10px rgba(0,0,0,.5);
text-shadow: 1px 1px 3px rgba(0,0,0,.7);
}
}
//Apply to container
.container1 {
input.button { @include button_basic(); }
button.button{ @include button_basic(); }
}
.container2 {
input.button { @include button_icon(); }
button.button{ @include button_icon($icon: 'next'); }
}
.container3 {
input.button { @include button_3D(); }
button.button{ @include button_3D(); }
}
.container4 {
input.button { @include button_outline(); }
button.button{ @include button_outline(); }
}
.container5 {
.button{ }
}
.container6 {
input.button { @include button_depth(); }
button.button{ @include button_depth(); }
}
.container7 {
.button{ }
}
.container8 {
.button{ }
}
.container9 {
.button{ }
}
Also see: Tab Triggers