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">
<h1>Bootstrap - Getting Started</h1>
<div class="row">
<div class="col-md-8">
<h2>CDN <small>Sponsored by <a href="https://www.maxcdn.com/open-source/">MaxCDN</a></small></h2>
<p>A content delivery network provides a fast way to deliver the webfont.</p>
<pre>//cdn.materialdesignicons.com/1.1.34/css/materialdesignicons.min.css</pre>
</div>
<div class="col-md-4">
<h2>Bower or NPM</h2>
<p>For <a href="http://bower.io/">Bower</a> or <a href="https://npmjs.com">NPM</a> use:</p>
<pre>bower install mdi
npm install mdi</pre>
</div>
</div>
<h2>CSS <small>Additional Icon Specific CSS</small></h2>
<pre style="height: 110px;">.mdi::before {
font-size: 24px;
line-height: 14px;
}
.btn .mdi::before {
position: relative;
top: 4px;
}
.btn-xs .mdi::before {
font-size: 18px;
top: 3px;
}
.btn-sm .mdi::before {
font-size: 18px;
top: 3px;
}
.dropdown-menu .mdi {
width: 18px;
}
.dropdown-menu .mdi::before {
position: relative;
top: 4px;
left: -8px;
}
.nav .mdi::before {
position: relative;
top: 4px;
}
.navbar .navbar-toggle .mdi::before {
position: relative;
top: 4px;
color: #FFF;
}
.breadcrumb .mdi::before {
position: relative;
top: 4px;
}
.breadcrumb a:hover {
text-decoration: none;
}
.breadcrumb a:hover span {
text-decoration: underline;
}
.alert .mdi::before {
position: relative;
top: 4px;
margin-right: 2px;
}
.input-group-addon .mdi::before {
position: relative;
top: 3px;
}
.navbar-brand .mdi::before {
position: relative;
top: 2px;
margin-right: 2px;
}
.list-group-item .mdi::before {
position: relative;
top: 3px;
left: -3px
}</pre>
<h2>Components</h2>
<div class="row">
<div class="col-md-5 example">
<div class="title">Button Groups</div>
<div class="btn-toolbar" role="toolbar">
<div class="btn-group">
<button type="button" class="btn btn-default" aria-label="Left Align">
<i class="mdi mdi-format-align-left" aria-hidden="true"></i>
</button>
<button type="button" class="btn btn-default" aria-label="Center Align"><i class="mdi mdi-format-align-center" aria-hidden="true"></i></button>
<button type="button" class="btn btn-default" aria-label="Right Align"><i class="mdi mdi-format-align-right" aria-hidden="true"></i></button>
<button type="button" class="btn btn-default" aria-label="Justify">
<i class="mdi mdi-format-align-justify" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
<div class="col-md-7">
<pre><div class="btn-toolbar" role="toolbar">
<div class="btn-group">
<button type="button"
class="btn btn-default"
aria-label="Left Align">
<i class="mdi mdi-format-align-left"
aria-hidden="true"></i>
</button>
...
</div>
</div></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Button Sizes</div>
<div class="m-b-10">
<button type="button" class="btn btn-xs btn-default">
<i class="mdi mdi-account"></i>
</button>
<button type="button" class="btn btn-xs btn-default">
<i class="mdi mdi-beaker"></i>
btn-xs
</button>
</div>
<div class="m-b-10">
<button type="button" class="btn btn-sm btn-default">
<i class="mdi mdi-account"></i>
</button>
<button type="button" class="btn btn-sm btn-default">
<i class="mdi mdi-beaker"></i>
btn-sm
</button>
</div>
<div class="m-b-10">
<button type="button" class="btn btn-default">
<i class="mdi mdi-account"></i>
</button>
<button type="button" class="btn btn-default">
<i class="mdi mdi-beaker"></i>
btn
</button>
</div>
<div class="m-b-10">
<button type="button" class="btn btn-lg btn-default">
<i class="mdi mdi-account"></i>
</button>
<button type="button" class="btn btn-lg btn-default">
<i class="mdi mdi-beaker"></i>
btn-lg
</button>
</div>
</div>
<div class="col-md-7">
<pre><button type="button" class="btn btn-default">
<i class="mdi mdi-account"></i>
</button>
<button type="button" class="btn btn-default">
<i class="mdi mdi-beaker"></i>
btn
</button></pre>
</div>
</div>
<div class="row">
<div class="col-md-6 example">
<div class="title">Button Group</div>
<div class="btn-group">
<button type="button" class="btn btn-default">
<i class="mdi mdi-account"></i>
Default
</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">
<i class="mdi mdi-sword"></i>
Action
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-security"></i>
Another action
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-pencil"></i>
Something else here
</a>
</li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
</div>
</div>
<div class="example">
<div class="title">Button Colors</div>
<button type="button" class="btn btn-default">
<i class="mdi mdi-account"></i>
Default
</button>
<button type="button" class="btn btn-primary">
<i class="mdi mdi-account"></i>
Primary
</button>
<button type="button" class="btn btn-success">
<i class="mdi mdi-account"></i>
Success
</button>
<button type="button" class="btn btn-info">
<i class="mdi mdi-account"></i>
Info
</button>
<button type="button" class="btn btn-warning">
<i class="mdi mdi-account"></i>
Warning
</button>
<button type="button" class="btn btn-danger">
<i class="mdi mdi-account"></i>
Danger
</button>
<button type="button" class="btn btn-link">
<i class="mdi mdi-link"></i>
Link
</button>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Tabs</div>
<ul class="nav nav-tabs">
<li role="presentation" class="active">
<a href="#">
<i class="mdi mdi-account"></i>
Home
</a>
</li>
<li role="presentation"><a href="#"><i class="mdi mdi-account"></i>Help</a></li>
<li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
<i class="mdi mdi-account"></i>
Dropdown
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">
<i class="mdi mdi-sword"></i>
Action
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-security"></i>
Another action
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-pencil"></i>
Something else here
</a>
</li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
<div class="col-md-7">
<pre><ul class="nav nav-tabs">
<li role="presentation" class="active">
<a href="#">
<i class="mdi mdi-account"></i>
Home
</a>
</li>
...
</ul></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Breadcrumbs</div>
<ol class="breadcrumb">
<li>
<a href="#">
<i class="mdi mdi-home-modern"></i>
<span>Home</span>
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-library"></i>
<span>Library</span>
</a>
</li>
<li class="active">
<i class="mdi mdi-database"></i>
<span>Data</span>
</li>
</ol>
</div>
<div class="col-md-7">
<pre><ol class="breadcrumb">
<li>
<a href="#">
<i class="mdi mdi-home-modern"></i>
<span>Home</span>
</a>
</li>
...
</ol></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Alert</div>
<div class="alert alert-danger" role="alert">
<span class="mdi mdi-alert-circle" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
Enter a valid email address
</div>
</div>
<div class="col-md-7">
<pre><div class="alert alert-danger" role="alert">
<span class="mdi mdi-alert-circle" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
Enter a valid email address
</div></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Input Group</div>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="mdi mdi-magnify"></i>
</button>
</span>
</div>
</div>
<div class="col-md-7">
<pre><div class="input-group">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="mdi mdi-magnify"></i>
</button>
</span>
</div></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Input Group Addon</div>
<div class="input-group">
<span class="input-group-addon"><i class="mdi mdi-tag"></i></span>
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
</div>
<div class="col-md-7">
<pre><div class="input-group">
<span class="input-group-addon"><i class="mdi mdi-tag"></i></span>
<input type="text" class="form-control" aria-label="Tag">
</div></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">Nav</div>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-9">
<span class="sr-only">Toggle navigation</span>
<i class="mdi mdi-menu"></i>
</button>
<a class="navbar-brand" href="#">
<i class="mdi mdi-package"></i>
Brand
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Link</a></li>
<li>
<a href="#">
<i class="mdi mdi-account"></i>
Link
</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div class="col-md-7">
<pre><nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#ex-navbar">
<span class="sr-only">Toggle navigation</span>
<i class="mdi mdi-menu"></i>
</button>
<a class="navbar-brand" href="#">
<i class="mdi mdi-package"></i>
Brand
</a>
</div>
<div class="collapse navbar-collapse" id="ex-navbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
...
</ul>
</div>
</div>
</nav></pre>
</div>
</div>
<div class="row">
<div class="col-md-5 example">
<div class="title">List</div>
<ul class="list-group">
<li class="list-group-item active">
<span class="badge">42</span>
<i class="mdi mdi-account"></i>
Cras justo odio
</li>
<li class="list-group-item">
<span class="badge">14</span>
<i class="mdi mdi-account"></i>
Dapibus ac facilisis in
</li>
<li class="list-group-item">
<i class="mdi mdi-account"></i>
Morbi leo risus
</li>
</ul>
</div>
<div class="col-md-7">
<pre><ul class="list-group">
<li class="list-group-item active">
<span class="badge">42</span>
<i class="mdi mdi-account"></i>
Cras justo odio
</li>
...
</ul></pre>
</div>
</div>
</div>
/* Setup */
body { padding: 40px 0; }
.container { width: 960px; }
.example { margin-bottom: 10px; }
.example .title { font-size: 14px; font-weight: bold; padding-bottom: 10px; }
.m-b-10 { margin-bottom: 10px; }
/* Bootstrap */
.mdi::before {
font-size: 24px;
line-height: 14px;
}
.btn .mdi::before {
position: relative;
top: 4px;
}
.btn-xs .mdi::before {
font-size: 18px;
top: 3px;
}
.btn-sm .mdi::before {
font-size: 18px;
top: 3px;
}
.dropdown-menu .mdi {
width: 18px;
}
.dropdown-menu .mdi::before {
position: relative;
top: 4px;
left: -8px;
}
.nav .mdi::before {
position: relative;
top: 4px;
}
.navbar .navbar-toggle .mdi::before {
position: relative;
top: 4px;
color: #FFF;
}
.breadcrumb .mdi::before {
position: relative;
top: 4px;
}
.breadcrumb a:hover { text-decoration: none; }
.breadcrumb a:hover span { text-decoration: underline; }
.alert .mdi::before {
position: relative;
top: 4px;
margin-right: 2px;
}
.input-group-addon .mdi::before {
position: relative;
top: 3px;
}
.navbar-brand .mdi::before {
position: relative;
top: 2px;
margin-right: 2px;
}
.list-group-item .mdi::before {
position: relative;
top: 3px;
left: -3px
}
Also see: Tab Triggers