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.
<h1>Create 3 same-height columns</h1>
<h2>With text and <code>columns</code> properties</h2>
<div class="column">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quo repellat ab reprehenderit maxime similique, veniam ratione eaque sit unde libero eius, accusamus aspernatur dolorum culpa esse neque perferendis sed, praesentium. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rerum illum fugit inventore eum ipsa quod hic sed quia veniam labore velit officiis, nemo quisquam ducimus nam quibusdam facilis modi qui. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sed impedit dicta, maiores sit laborum quidem! Quod impedit perspiciatis saepe optio minus culpa iste, debitis aperiam ipsa vitae provident neque quo. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Unde non obcaecati suscipit voluptatem. Cupiditate eligendi itaque, libero fugit laudantium aperiam totam nobis ab saepe, veritatis, error ullam molestiae quam sunt. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores recusandae minus dolor velit vitae nostrum modi dignissimos animi explicabo vel repellendus, rerum praesentium, suscipit nobis facere facilis consequatur provident ab!
Sed, amet, deleniti! Velit, facilis dignissimos, quo vel quasi minus perferendis dolores, nam temporibus modi vitae impedit. Eaque adipisci hic earum nisi repudiandae ut unde doloribus odit qui. Cumque, dicta!
Magni molestiae ipsam iste! Qui mollitia, est accusamus eum debitis quisquam iusto unde facilis. Est incidunt, quas culpa ipsam dolore dignissimos repellendus labore porro magni cum, cumque harum? Non, molestiae.</div>
<h2>With the content you want and <code>display:table</code></h2>
<div class="table">
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit quia, quam delectus sequi odio fugit pariatur architecto, deleniti exercitationem quae adipisci ipsum ullam officia ea!</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur adipisci, quod voluptates, vel nostrum ea distinctio, a tempore voluptas reiciendis doloremque veniam, accusantium. Veritatis ipsum modi doloribus enim sint magnam, delectus dolorum, aperiam! Eaque dolor, veniam eum sunt dolorem nostrum. Dolores, corporis! Magnam, amet quas? Voluptates eaque quaerat quia inventore, earum eveniet hic alias rem atque neque ab, reprehenderit dolore culpa, blanditiis! Maiores enim rerum architecto voluptatibus cumque. Debitis accusamus ea aut incidunt voluptatibus quibusdam rem sint laboriosam qui sit odio expedita illum iste consectetur fugit eaque commodi pariatur, porro ex delectus officia ratione necessitatibus totam. Necessitatibus est autem et.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque velit dolores ipsa maiores molestias minus iusto nulla consequatur saepe. Aspernatur nulla optio laborum ducimus dignissimos nisi itaque aliquam doloremque, iure qui. Corporis quas atque minus, eveniet delectus officiis dolor, neque, animi, deleniti adipisci esse! Ullam nesciunt, nemo fugit totam itaque.</div>
</div>
<h2>With the content you want and <code>display: flex;</code></h2>
<p>The best solution!</p>
<div class="flexbox">
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laboriosam quibusdam corporis officiis consequatur eveniet at ipsa deleniti consectetur fugiat similique illo alias perspiciatis quam repellendus, quisquam mollitia error corrupti vitae ut expedita numquam nemo aspernatur ratione maxime! Amet ea commodi itaque voluptatibus. Dolor repellat consequatur dicta ab repudiandae quo architecto.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea quos dicta, reprehenderit laborum! Quidem repellendus culpa, quisquam laboriosam quam ducimus id sit fugit obcaecati aspernatur.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi explicabo, amet debitis natus enim magnam eos ab voluptate minima delectus. Tenetur porro possimus obcaecati harum facere est tempore cum enim dignissimos ducimus, eum illo quam cupiditate vel iusto voluptatum nesciunt nobis velit at, voluptatibus quos. Repudiandae nulla alias iure eligendi, saepe libero et dolor tempora.</div>
</div>
/* COLUMNS partial solution */
.column {
padding: 25px;
columns: 3;
column-rule: 15px solid #F2F2F2;
background: #fff;
background-clip: content-box;
}
/* TABLE solution */
.table {
display: table;
width: 100%;
border-collapse: separate;
}
.table div {
display: table-cell;
width: 33.3333%;
background: #FFF;
border: 5px #F2F2F2 solid;
padding: 20px;
box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset;
}
/* FLEXBOX solution */
.flexbox,
.flexbox > div {
display: flex;
}
.flexbox > div {
width: 50%;
padding: 20px;
margin: 10px;
background: #FFF;
box-shadow: 0 0 3px rgba(0,0,0,0.05)
}
/* Useless code */
body {
font-family: "Open Sans", Helvetica, Arial, sans-serif;
font-size: 0.95em;
color: #333;
background: #F2F2F2;
}
h1, h2 {
font-weight: lighter;
text-align: center;
}
h1 {
font-size: 2.5em
}
h2 {
margin-top: 4em;
}
h1+h2 {
margin-top: 1.5em;
}
h2 + p {
text-align: center;
color: #555;
}
Also see: Tab Triggers