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.
<!-- view modal -->
<button class="btn btn-primary btn-modal"
data-toggle="modal"
data-target="#fsModal">
View Fullscreen Modal
</button>
<!-- view modal -->
<!-- modal -->
<div id="fsModal"
class="modal animated bounceIn"
tabindex="-1"
role="dialog"
aria-labelledby="myModalLabel"
aria-hidden="true">
<!-- dialog -->
<div class="modal-dialog">
<!-- content -->
<div class="modal-content">
<!-- header -->
<div class="modal-header">
<h1 id="myModalLabel"
class="modal-title">
Modal title
</h1>
</div>
<!-- header -->
<!-- body -->
<div class="modal-body">
<h2>1. Modal sub-title</h2>
<p>Liquor ipsum dolor sit amet bearded lady, grog murphy's bourbon lancer. Kamikaze vodka gimlet; old rip van winkle, lemon drop martell salty dog tom collins smoky martini ben nevis man o'war. Strathmill grand marnier sea breeze b & b mickey slim. Cactus jack aberlour seven and seven, beefeater early times beefeater kalimotxo royal arrival jack rose. Cutty sark scots whisky b & b harper's finlandia agent orange pink lady three wise men gin fizz murphy's. Chartreuse french 75 brandy daisy widow's cork 7 crown ketel one captain morgan fleischmann's, hayride, edradour godfather. Long island iced tea choking hazard black bison, greyhound harvey wallbanger, "gibbon kir royale salty dog tonic and tequila."</p>
<h2>2. Modal sub-title</h2>
<p>The last word drumguish irish flag, hurricane, brandy manhattan. Lemon drop, pulteney fleischmann's seven and seven irish flag pisco sour metaxas, hayride, bellini. French 75 wolfram christian brothers, calvert painkiller, horse's neck old bushmill's gin pahit. Monte alban glendullan, edradour redline cherry herring anisette godmother, irish flag polish martini glen spey. Abhainn dearg bloody mary amaretto sour, ti punch black cossack port charlotte tequila slammer? Rum swizzle glen keith j & b sake bomb harrogate nights 7 crown! Hairy virgin tomatin lord calvert godmother wolfschmitt brass monkey aberfeldy caribou lou. Macuá, french 75 three wise men.</p>
<h2>3. Modal sub-title</h2>
<p>Pisco sour daiquiri lejon bruichladdich mickey slim sea breeze wolfram kensington court special: pink lady white lady or delilah. Pisco sour glen spey, courvoisier j & b metaxas glenlivet tormore chupacabra, sambuca lorraine knockdhu gin and tonic margarita schenley's." Bumbo glen ord the macallan balvenie lemon split presbyterian old rip van winkle paradise gin sling. Myers black bison metaxa caridan linkwood three wise men blue hawaii wine cooler?" Talisker moonwalk cosmopolitan wolfram zurracapote glen garioch patron saketini brandy alexander, singapore sling polmos krakow golden dream. Glenglassaugh usher's wolfram mojito ramos gin fizz; cactus jack. Mai-tai leite de onça bengal; crown royal absolut allt-á-bhainne jungle juice bacardi benrinnes, bladnoch. Cointreau four horsemen aultmore, "the amarosa cocktail vodka gimlet ardbeg southern comfort salmiakki koskenkorva."</p>
</div>
<!-- body -->
<!-- footer -->
<div class="modal-footer">
<button class="btn btn-secondary"
data-dismiss="modal">
close
</button>
<button class="btn btn-default">
Default
</button>
<button class="btn btn-primary">
Primary
</button>
</div>
<!-- footer -->
</div>
<!-- content -->
</div>
<!-- dialog -->
</div>
<!-- modal -->
@import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400);
.font-roboto {
font-family: 'roboto condensed';
}
* {
box-sizing: border-box;
}
body {
.font-roboto();
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
}
.modal-dialog {
position: fixed;
margin: 0;
width: 100%;
height: 100%;
padding: 0;
}
.modal-content {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border: 2px solid #3c7dcf;
border-radius: 0;
box-shadow: none;
}
.modal-header {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 50px;
padding: 10px;
background: #6598d9;
border: 0;
}
.modal-title {
font-weight: 300;
font-size: 2em;
color: #fff;
line-height: 30px;
}
.modal-body {
position: absolute;
top: 50px;
bottom: 60px;
width: 100%;
font-weight: 300;
overflow: auto;
}
.modal-footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 60px;
padding: 10px;
background: #f1f3f5;
}
.btn {
height: 40px;
border-radius: 0;
// focus
&:focus,
&:active,
&:active:focus {
box-shadow: none;
outline: none;
}
}
.btn-modal {
position: absolute;
top: 50%;
left: 50%;
margin-top: -20px;
margin-left: -100px;
width: 200px;
}
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
font-weight: 300;
font-size: 1.6rem;
color: #fff;
color: lighten(#484b5b, 20%);
color: #fff;
text-align: center;
background: #60cc69;
border: 1px solid #36a940;
border-bottom: 3px solid #36a940;
box-shadow: 0 2px 4px rgba(0,0,0,0.15);
// active
&:active {
border-bottom: 1px solid #36a940;
}
}
.btn-default,
.btn-default:hover,
.btn-default:focus,
.btn-default:active {
font-weight: 300;
font-size: 1.6rem;
color: #fff;
text-align: center;
background: darken(#dcdfe4, 10%);
border: 1px solid darken(#dcdfe4, 20%);
border-bottom: 3px solid darken(#dcdfe4, 20%);
// active
&:active {
border-bottom: 1px solid darken(#dcdfe4, 20%);
}
}
.btn-secondary,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
color: #cc7272;
background: transparent;
border: 0;
}
h1,
h2,
h3 {
color: #60cc69;
line-height: 1.5;
// first
&:first-child {
margin-top: 0;
}
}
p {
font-size: 1.4em;
line-height: 1.5;
color: lighten(#5f6377, 20%);
// last
&:last-child {
margin-bottom: 0;
}
}
::-webkit-scrollbar {
-webkit-appearance: none;
width: 10px;
background: #f1f3f5;
border-left: 1px solid darken(#f1f3f5, 10%);
}
::-webkit-scrollbar-thumb {
background: darken(#f1f3f5, 20%);
}
Also see: Tab Triggers