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="container py-5">
<!-- H1 heading purpose only -->
<h1 class="text-center font-weight-light text-dark mb-5 pb-3 display-4">Bootstrap 4 <em class="px-2 bg-warning">Hover</em> Button Icon</h1>
<!-- Rounded Button | Font Awesome -->
<h1 class="font-weight-light">Font Awesome</h1>
<div class="row my-4">
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-primary btn-lg btn-iconed btn-rounded">
<i class="fa fa-chevron-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-primary my-3">
<i class="fa fa-chevron-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-warning btn-lg btn-iconed btn-rounded">
<i class="fa fa-arrow-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-warning my-3">
<i class="fa fa-arrow-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-danger btn-lg btn-iconed btn-rounded">
<i class="fa fa-heart"></i> <span class="spn">Submit</span>
</button>
<div class="text-danger my-3">
<i class="fa fa-heart fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-info btn-lg btn-iconed btn-rounded">
<i class="fa fa-long-arrow-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-info my-3">
<i class="fa fa-long-arrow-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-success btn-lg btn-iconed btn-rounded">
<i class="fa fa-arrow-circle-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-success my-3">
<i class="fa fa-arrow-circle-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-secondary btn-lg btn-iconed btn-rounded">
<i class="fa fa-pencil"></i> <span class="spn">Submit</span>
</button>
<div class="text-secondary my-3">
<i class="fa fa-pencil fa-2x"></i>
</div>
</div>
</div>
<!-- Flatted Button | Open Iconic -->
<h1 class="font-weight-light">Open Iconic</h1>
<div class="row my-4">
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-primary btn-lg btn-iconed btn-flat">
<i class="oi oi-bolt"></i> <span class="spn">Submit</span>
</button>
<div class="text-primary my-3">
<i class="oi oi-bolt fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-warning btn-lg btn-iconed btn-flat">
<i class="oi oi-droplet"></i> <span class="spn">Submit</span>
</button>
<div class="text-warning my-3">
<i class="oi oi-droplet fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-danger btn-lg btn-iconed btn-flat">
<i class="oi oi-key"></i> <span class="spn">Submit</span>
</button>
<div class="text-danger my-3">
<i class="oi oi-key fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-info btn-lg btn-iconed btn-flat">
<i class="oi oi-check"></i> <span class="spn">Submit</span>
</button>
<div class="text-info my-3">
<i class="oi oi-check fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-success btn-lg btn-iconed btn-flat">
<i class="oi oi-arrow-circle-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-success my-3">
<i class="oi oi-arrow-circle-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-secondary btn-lg btn-iconed btn-flat">
<i class="oi oi-arrow-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-secondary my-3">
<i class="oi oi-arrow-left fa-2x"></i>
</div>
</div>
</div>
<!-- Standard Button | Material Design Icons -->
<h1 class="font-weight-light">Material Design Icons</h1>
<div class="row my-4">
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-primary btn-lg btn-iconed">
<i class="mdi mdi-codepen"></i> <span class="spn">Submit</span>
</button>
<div class="text-primary my-3">
<i class="mdi mdi-codepen fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-warning btn-lg btn-iconed">
<i class="mdi mdi-silverware"></i> <span class="spn">Submit</span>
</button>
<div class="text-warning my-3">
<i class="mdi mdi-silverware fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-danger btn-lg btn-iconed">
<i class="mdi mdi-coffee"></i> <span class="spn">Submit</span>
</button>
<div class="text-danger my-3">
<i class="mdi mdi-coffee fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-info btn-lg btn-iconed">
<i class="mdi mdi-plus-outline"></i> <span class="spn">Submit</span>
</button>
<div class="text-info my-3">
<i class="mdi mdi-plus-outline fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-success btn-lg btn-iconed">
<i class="mdi mdi-arrow-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-success my-3">
<i class="mdi mdi-arrow-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-secondary btn-lg btn-iconed">
<i class="mdi mdi-skull"></i> <span class="spn">Submit</span>
</button>
<div class="text-secondary my-3">
<i class="mdi mdi-skull fa-2x"></i>
</div>
</div>
</div>
<!-- Rounded Button | Ionicons -->
<h1 class="font-weight-light">Ionicons</h1>
<div class="row my-4">
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-primary btn-lg btn-iconed btn-rounded">
<i class="icon ion-md-checkmark"></i> <span class="spn">Submit</span>
</button>
<div class="text-primary my-3">
<i class="icon ion-md-checkmark fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-warning btn-lg btn-iconed btn-rounded">
<i class="icon ion-md-send"></i> <span class="spn">Submit</span>
</button>
<div class="text-warning my-3">
<i class="icon ion-md-send fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-danger btn-lg btn-iconed btn-rounded">
<i class="icon ion-logo-codepen"></i> <span class="spn">Submit</span>
</button>
<div class="text-danger my-3">
<i class="icon ion-logo-codepen fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-info btn-lg btn-iconed btn-rounded">
<i class="icon ion-md-pizza"></i> <span class="spn">Submit</span>
</button>
<div class="text-info my-3">
<i class="icon ion-md-pizza fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-success btn-lg btn-iconed btn-rounded">
<i class="icon ion-md-exit"></i> <span class="spn">Submit</span>
</button>
<div class="text-success my-3">
<i class="icon ion-md-exit fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-secondary btn-lg btn-iconed btn-rounded">
<i class="icon ion-md-contract"></i> <span class="spn">Submit</span>
</button>
<div class="text-secondary my-3">
<i class="icon ion-md-contract fa-2x"></i>
</div>
</div>
</div>
<!-- Rounded Button | Typicons -->
<h1 class="font-weight-light">Typicons</h1>
<div class="row my-4">
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-primary btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-arrow-left"></i> <span class="spn">Submit</span>
</button>
<div class="text-primary my-3">
<i class="typcn typcn-arrow-left fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-warning btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-thumbs-up"></i> <span class="spn">Submit</span>
</button>
<div class="text-warning my-3">
<i class="typcn typcn-thumbs-up fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-danger btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-message-typing"></i> <span class="spn">Submit</span>
</button>
<div class="text-danger my-3">
<i class="typcn typcn-message-typing fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-info btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-pin"></i> <span class="spn">Submit</span>
</button>
<div class="text-info my-3">
<i class="typcn typcn-pin fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-success btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-warning"></i> <span class="spn">Submit</span>
</button>
<div class="text-success my-3">
<i class="typcn typcn-warning fa-2x"></i>
</div>
</div>
<div class="col-md-2 text-center">
<!-- button classes -->
<button role="button" class="btn btn-outline-secondary btn-lg btn-iconed btn-rounded">
<i class="typcn typcn-infinity-outline"></i> <span class="spn">Submit</span>
</button>
<div class="text-secondary my-3">
<i class="typcn typcn-infinity-outline fa-2x"></i>
</div>
</div>
</div>
</div>
/** Body CSS sample **/
body {
background:rgb(255, 247, 233);
}
/** Flatted button %placeholder **/
%btn-flat {
border-radius: 0rem;
/* margin-right: 2rem; Icon sample spacing */
}
/** Rounded button **/
.btn-rounded {
border-radius: 5rem;
/* margin-right: 2rem; Icon sample spacing */
}
/** Button Iconed **/
.btn {
&-iconed {
transition: .15s ease-in-out;
padding-left: 1.3rem;
padding-right: 1.5rem;
/** Icons Classes **/
/** -- Open Iconic, Font Awesome -- **/
[class~=oi], [class~=fa],
/** -- Since Material, Iconic and Typicons use ::before -- **/
[class~=typcn]::before,
[class~=mdi]::before,
[class~=icon]::before {
opacity: 0;
transform-origin: left right;
transform: translateX(-10px) scale(1.25);
transition: .15s ease-out;
}
/** Span Class **/
[class=spn] {
position: relative;
left:-9px;
transform-origin: left right;
transform: translateX(-9px);
transition: .20s ease-in-out;
}
/** -- Icons on Hover properties -- **/
&:hover {
[class~=oi], [class~=fa],
/** -- Since Material, Iconic and Typicons use ::before -- **/
[class~=mdi]::before, [class~=icon]::before, [class~="typcn"]::before {
opacity: 1;
transform: translateX(0px) scale(.75);
}
/** -- Span on Hover properties -- **/
[class=spn] {
// transform: translateX(0);
left:0px;
}
// padding-left: 2rem;
}
/** Flatted button **/
&.btn-flat {
@extend %btn-flat;
}
}
}
/** style.scss -- source **/
Also see: Tab Triggers