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">
<div class="shape"></div>
<div class="shape2"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu bibendum at varius vel pharetra vel turpis. Lobortis scelerisque fermentum dui faucibus in. Amet consectetur adipiscing elit pellentesque habitant. Dignissim cras tincidunt lobortis feugiat. Senectus et netus et malesuada fames ac turpis egestas sed. Risus commodo viverra maecenas accumsan lacus vel facilisis volutpat est. Diam quis enim lobortis scelerisque fermentum dui faucibus in. Netus et malesuada fames ac. Blandit massa enim nec dui nunc mattis. Est placerat in egestas erat imperdiet sed. Ultrices in iaculis nunc sed augue. Blandit aliquam etiam erat velit scelerisque. Nec ultrices dui sapien eget mi proin sed. Nibh tortor id aliquet lectus. Arcu vitae elementum curabitur vitae nunc sed velit dignissim sodales. Ac tortor vitae purus faucibus ornare suspendisse. Enim praesent elementum facilisis leo vel fringilla est ullamcorper. Non consectetur a erat nam at lectus urna duis convallis. Euismod lacinia at quis risus sed. Sem integer vitae justo eget magna fermentum iaculis eu. Velit euismod in pellentesque massa placerat duis ultricies. Scelerisque fermentum dui faucibus in ornare. Ut consequat semper viverra nam libero justo laoreet sit amet. Tortor pretium viverra suspendisse potenti nullam ac tortor vitae purus. Varius vel pharetra vel turpis nunc eget lorem dolor sed. Sed id semper risus in.</p>
</div>
* {
box-sizing: border-box;
}
p {
padding: 20px 0;
}
.container {
margin: 20px;
padding-right: 20px;
height: 460px;
max-width: 800px;
background-color: #FFECB3;
position: relative;
z-index: 1;
&::before {
height: 100%;
width: 100%;
background-color: #9C27B0;
clip-path: polygon(100px 0, calc(100% - 200px) 0, calc(100% - 100px) 50%, calc(100% - 200px) 100%, 100px 100%, 180px 50%);
position: absolute;
content: '';
z-index: -1;
}
&::after {
height: 100%;
width: 100%;
background-color: #FFA000;
clip-path: polygon(100px 0, calc(100% - 200px) 0, calc(100% - 100px) 50%, calc(100% - 200px) 100%, 100px 100%, 180px 50%);
position: absolute;
top: 20px;
left: -40px;
content: '';
z-index: -2;
filter: blur(100px);
}
}
.shape {
width: 200px;
height: 460px;
float: left;
shape-outside: polygon(0 0, 100px 0, 180px 50%, 100px 100%, 0 100%);
shape-margin: 10px;
}
.shape2 {
float: right;
width: 200px;
height: 460px;
shape-outside: polygon(0 0, 100% 0, 100% 100%, 0 100%, 100px 50%);
shape-margin: 10px;
}
Also see: Tab Triggers