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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
.container
input#tab-1(type='radio', name='tabs', checked)
input#tab-2(type='radio', name='tabs')
input#tab-3(type='radio', name='tabs')
input#tab-4(type='radio', name='tabs')
.tabs
label(for='tab-1') Really
label(for='tab-2') Awesome
label(for='tab-3') CSS-only
label(for='tab-4') Tabs
.content
.tab
h3 Lanyard belay parley spyglass.
p
| Parrel ho galleon handsomely cutlass piracy hang the jib smartly pirate. Hornswaggle come about boom execution dock quarter barque bilged on her anchor fire ship Cat o'nine tails. Swing the lead pinnace carouser hulk Sail ho hornswaggle blow the man down Buccaneer Arr. List lanyard brig squiffy sloop Sea Legs no prey, no pay barque trysail. Jack gun heave to haul wind hail-shot fore carouser broadside Yellow Jack.
p
| Provost jury mast gaff man-of-war lanyard haul wind overhaul yawl chase. Gunwalls quarterdeck square-rigged lad Corsair tackle weigh anchor line Sink me. Wherry swing the lead bilge rutters cable poop deck rope's end avast pirate. Marooned Barbary Coast main sheet gangway lad brig chantey gally crow's nest. Port sutler ahoy scurvy clipper bilge water reef sails American Main bring a spring upon her cable.
.tab
h3 Red ensign loaded to the gunwalls Davy Jones' Locker.
p
| Boatswain square-rigged rope's end fathom barkadeer gabion pinnace. Scuttle topgallant interloper bilge water Sea Legs hardtack league. Barbary Coast cackle fruit rigging poop deck quarterdeck bucko ahoy. Blimey topgallant Pieces of Eight ye landlubber or just lubber loaded to the gunwalls spike.
.tab
h3 Pirate Ipsum
p
| Pirate Ipsum from
a(href='http://idsgn.dropmark.com/107/1313404') here
|.
p
| Sea Legs transom port spanker heave to prow chandler. Line scallywag cackle fruit swing the lead scuppers wherry lateen sail. Coxswain barkadeer code of conduct jack wench bring a spring upon her cable to go on account.
.tab
h3 Ho black jack prow
p
| Run a shot across the bow strike colors hang the jib man-of-war gun lookout Nelsons folly holystone jury mast skysail. Plunder jib Blimey run a rig scallywag lookout line tack Brethren of the Coast bilge water. Square-rigged sheet spyglass Sail ho barkadeer Privateer piracy plunder gun belaying pin. Splice the main brace gaff grog clipper fore Plate Fleet scourge of the seven seas me lanyard yardarm.
p
| Lad gangway league draught Spanish Main tack gally flogging handsomely prow. Barbary Coast pinnace lad scuttle fathom shrouds pirate wherry interloper yo-ho-ho. Mizzenmast gibbet hang the jib smartly Admiral of the Black yo-ho-ho square-rigged avast code of conduct bilged on her anchor. Keel bilge rat hang the jib lugger reef driver trysail Nelsons folly schooner wherry.
p
| Jib capstan boatswain rutters scuttle lugsail nipper starboard loot hail-shot. Transom barque hearties chantey skysail gunwalls wherry Letter of Marque blow the man down landlubber or just lubber. Bounty rum Buccaneer wench draft bucko chantey ho Sink me hogshead. Blow the man down keel log trysail jolly boat pinnace come about hearties grapple nipperkin.
p
| Take a caulk dance the hempen jig Cat o'nine tails mizzen lateen sail pink aye to go on account warp bowsprit.
@import 'https://fonts.googleapis.com/css?family=Roboto:400,700';
$tabs: 4;
$color: #242B36;
$brand: #D22C3F;
*, :before, :after {
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(#000,0);
}
body {
background: $brand;
font-family: Roboto;
}
input[name="tabs"] {
display: none;
@for $i from 1 through $tabs {
&#tab-#{$i}:checked {
~ .content .tab:nth-of-type(#{$i}) {
display: inline-block;
}
~ .tabs label:nth-child(#{$i}) {
color: #242b36;
&:after {
width: calc(100% - 40px);
transition: .3s;
}
}
}
}
}
.tabs {
box-shadow: 0 20px 50px -25px rgba(0, 0, 0, .3);
overflow-X: auto;
-webkit-overflow-scrolling: touch;
position: relative;
white-space: nowrap;
label {
display: inline-block;
padding: 18px;
position: relative;
color: lighten($color, 60%);
font-weight: 700;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 1.5px;
cursor: pointer;
&:after {
content: '';
background: $brand;
width: 0;
height: 4px;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
transition: .1s;
}
}
}
.container {
background: #FFF;
width: 90%;
border-radius: 3px;
box-shadow: 0 50px 75px -25px rgba(0, 0, 0, .3);
margin: 25px auto;
overflow: hidden;
.tab {
display: none;
background: #F6F6F6;
padding: 0 20px;
}
}
Also see: Tab Triggers