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 id="wrapper">
<p>
<span class="shape circle"></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin hendrerit elementum fringilla. Mauris laoreet risus enim, a tincidunt eros pulvinar ultrices. Maecenas sagittis nulla congue sem aliquet, a placerat est consequat. Morbi porttitor ante at tellus facilisis, eget commodo turpis porta. In non ipsum ex. Aenean in neque id lectus lacinia scelerisque sit amet id lectus. Ut gravida sem sit amet nunc suscipit, in scelerisque quam gravida. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin hendrerit elementum fringilla. Mauris laoreet risus enim, a tincidunt eros pulvinar ultrices. Maecenas sagittis nulla congue sem aliquet, a placerat est consequat. Morbi porttitor ante at tellus facilisis, eget commodo turpis porta. In non ipsum ex. Aenean in neque id lectus lacinia scelerisque sit amet id lectus. Ut gravida sem sit amet nunc suscipit, in scelerisque quam gravida.
</p>
<p><span class="shape ellipse"></span>
Duis quis tellus lacus. Nam ut mollis est. Mauris ornare eget nibh quis sagittis. Sed ut tor tor mo le st ie, auc tor leo et, mat tis ex. Cu rab itur el ei fe nd eg est as ex, a eff ici tur or ci auc tor ac. Int eg er iac ul is ve sti bu lum do lor auc tor mal esu ada. Cu ra bitur pos uere nibh vel euismod luctus. Vivamus nec augue dui. Duis consequat nisi quis od io accumsan mollis. Proin congue vitae nibh non eleifend. Donec sit amet feugiat dui. Aliquam euismod, risus quis semper consequat, nulla mauris tincidunt nibh, ac varius dolor ligula gravida dui. Vestibulum molestie molestie metus at porta. Nullam id neque lacus. Morbi interdum ante in lorem varius, nec ultricies augue tempor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin hendrerit elementum fringilla. Mauris laoreet risus enim, a tincidunt eros pulvinar ultrices. Maecenas sagittis nulla congue sem aliquet, a placerat est consequat. Morbi porttitor ante at tellus facilisis, eget commodo turpis porta. In non ipsum ex. Aenean in neque id lectus lacinia scelerisque sit amet id lectus. Ut gravida sem sit amet nunc suscipit, in scelerisque quam gravida.
</p>
<p><span class="shape rectangle"></span>
Proin in magna nibh. Sed sed varius justo. Etiam eu porta nunc, eget porttitor ante. Praesent nec tempus lectus. Curabitur molestie, purus at mollis pharetra, dui nisi dignissim diam, at vehicula odio purus ut nunc. Sed sed lobortis tortor. Nulla auctor velit lacus, ut aliquam massa imperdiet ut. Proin in magna nibh. Sed sed varius justo. Etiam eu porta nunc, eget porttitor ante. Praesent nec tempus lectus. Curabitur molestie, purus at mollis pharetra, dui nisi dignissim diam, at vehicula odio purus ut nunc. Sed sed lobortis tortor. Nulla auctor velit lacus, ut aliquam massa imperdiet ut. Proin in magna nibh. Sed sed varius justo. Etiam eu porta nunc, eget porttitor ante. Praesent nec tempus lectus. Curabitur molestie, purus at mollis pharetra, dui nisi dignissim diam, at vehicula odio purus ut nunc. Sed sed lobortis tortor. Nulla auctor velit lacus, ut aliquam massa imperdiet ut.
</p>
<p><span class="shape rounded-rectangle"></span>
Maecenas bibendum iaculis odio, non commodo purus molestie in. Sed sed metus eu purus molestie efficitur. Aliquam ac massa id quam sollicitudin euismod. Nulla eget nulla aliquet, congue orci sit amet, pellentesque est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Phasellus bibendum augue erat, in congue nisl rhoncus consectetur. Praesent aliquam elit lacus, at dapibus nulla mollis sit amet. Donec ac ullamcorper purus. Nulla faucibus odio sodales lacinia gravida. Mauris fringilla tortor lacus, nec lacinia dui porttitor quis. Donec consectetur, odio in aliquam consectetur, urna velit scelerisque erat, sed viverra massa tellus nec leo. Aliquam mollis metus mauris. Phasellus orci tellus, pellentesque viverra libero posuere, elementum auctor leo. Proin a feugiat turpis. Nulla rhoncus ipsum augue, at iaculis odio convallis eu.
</p>
<p><span class="shape trapezoid"></span>
Proin in magna nibh. Sed sed varius justo. Etiam eu porta nunc, eget porttitor ante. Praesent nec tempus lectus. Curabitur molestie, purus at mollis pharetra, dui nisi dignissim diam, at vehicula odio purus ut nunc. Sed sed lobortis tortor. Nulla auctor velit lacus, ut aliquam massa imperdiet ut.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin hendrerit elementum fringilla. Mauris laoreet risus enim, a tincidunt eros pulvinar ultrices. Maecenas sagittis nulla congue sem aliquet, a placerat est consequat. Morbi porttitor ante at tellus facilisis, eget commodo turpis porta. In non ipsum ex. Aenean in neque id lectus lacinia scelerisque sit amet id lectus. Ut gravida sem sit amet nunc suscipit, in scelerisque quam gravida.
</p>
<img class="image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1804713/image-shape.png">
<p>
Sed nec odio elit. Suspendisse pulvinar, nulla varius tempus feu giat, magna nulla feugiat neque, vel tempus nibh tellus nec metus. Vesti bulum et velit eu ligula tinc idunt vesti bulum. Aenean urna est, ullam corper ac tempus a, volu tpat et lacus. Vesti bulum at odio ac mi fin ibus laor eet. Curabitur maximus, orci at interdum fring illa, tortor magna auctor nunc, id auctor tortor nisl a est. Prae sent ultr icies accumsan magna. Al iquam posuere hendrerit felis, sed varius leo congue ac. Proin vulp utat electus at ullamcorper pulvinar, mi mi rhoncus lorem, a laoreet justo neque vel orci. Mauris in libero in urna vestibulum tincidunt id aliquam neque. Sed vitae sollicitudin est. Nullam fermentum neque lorem, in porttitor dolor rhoncus in. Praesent dapibus eros quis odio eleifend, et viverra neque mattis. Etiam vulputate velit vitae leo malesuada, a cursus orci feugiat. Praesent suscipit non urna at eleifend.
</p>
<p><span class="shape gradient"></span>
Sed nec odio elit. Suspendisse pulvinar, nulla varius tempus feugiat, magna nulla feugiat neque, vel tempus nibh tellus nec metus. Vestibulum et velit eu ligula tincidunt vestibulum. Aenean urna est, ullamcorper ac tempus a, volutpat et lacus. Vestibulum at odio ac mi finibus laoreet. Curabitur maximus, orci at interdum fringilla, tortor magna auctor nunc, id auctor tortor nisl a est. Praesent ultricies accumsan magna. Aliquam posuere hendrerit felis, sed varius leo congue ac. Proin vulputate, lectus at ullamcorper pulvinar, mi mi rhoncus lorem, a laoreet justo neque vel orci. Mauris in libero in urna vestibulum tincidunt id aliquam neque. Sed vitae sollicitudin est. Nullam fermentum neque lorem, in porttitor dolor rhoncus in. Praesent dapibus eros quis odio eleifend, et viverra neque mattis. Etiam vulputate velit vitae leo malesuada, a cursus orci feugiat. Praesent suscipit non urna at eleifend.
</p>
</div>
.shape {
background-color: darkred;
width: 200px;
height: 200px;
float: left;
}
.circle {
shape-outside: circle( 100px at 50% 50%);
border-radius: 50%;
}
.ellipse {
shape-outside: ellipse( 100px 140px at 50% 50%);
height: 300px;
border-radius: 50%;
}
.rectangle {
shape-outside: inset( 20px 30px 50px 0);
}
.rounded-rectangle {
shape-outside: inset( 10px 10px 10px 10px round 50px);
border-radius: 50px;
}
.trapezoid {
shape-outside: polygon(37px 9px, 157px 7px, 189px 131px, 7px 127px);
background: transparent;
}
@supports (clip-path: polygon(37px 9px, 157px 7px, 189px 131px, 7px 127px)) {
.trapezoid {
clip-path: polygon(37px 9px, 157px 7px, 189px 131px, 7px 127px);
background-color: darkred;
}
}
.image {
shape-outside: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1804713/image-shape.png);
height: 400px;
width: 400px;
float: right;
}
.gradient{
background: linear-gradient(37deg, rgba(0,212,255,1) 0%, rgba(2,0,36,0) 100%);
shape-outside: linear-gradient(37deg, rgba(0,212,255,1) 0%, rgba(2,0,36,0) 100%);
shape-image-threshold: 0.5;
}
* { box-sizing: border-box; }
body {
background-color: black;
}
#wrapper {
width: 100%;
max-width: 1000px;
font-size: 1.5em;
margin: auto;
line-height: 1.25;
color:#FFF;
}
Also see: Tab Triggers