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="button">HOME</div>
<div class="button">PORTFOLIO</div>
<div class="button">ABOUT</div>
<div class="button">CONTACT</div>
<div class="block"></div>
</div>
<p><a href="https://www.youtube.com/watch?v=AaTvB4uHhxc" target="_blank">CSS Morph Tutorial</a> from <a href="https://twitter.com/code_laboratory">Frank's Laboratory</p>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 800px;
position: relative;
margin: 90px auto;
}
.button {
width: 220px;
height: 100px;
background-color: rgb(17, 138, 132);
transition: .5s;
font-size: 35px;
color: white;
text-align: left;
margin: 10px;
line-height: 100px;
padding-left: 20px;
border-radius: 10%;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
clip-path: polygon(0 0, 55% 0, 100% 0, 100% 50%, 100% 100%, 46% 100%, 0 100%);
}
.button:hover {
clip-path: polygon(0% 20%, 60% 20%, 60% 0%, 100% 50%, 60% 100%, 60% 80%, 0% 80%);
}
.block {
position: absolute;
top: 0;
left: 180px;
width: 700px;
height: 500px;
transition: .7s;
background-color: rgb(77, 15, 105);
clip-path: polygon(277px 16px,260px 42px,238px 43px,226px 21px,193px 6px,136px 0px,152px 50px,184px 79px,116px 154px,160px 138px,138px 178px,177px 172px,159px 234px,166px 271px,170px 308px,152px 391px,137px 420px,197px 417px,195px 388px,213px 337px,217px 380px,218px 418px,264px 419px,251px 393px,286px 391px,272px 419px,288px 419px,368px 417px,419px 369px,451px 283px,449px 190px,481px 176px,549px 184px,581px 213px,631px 208px,618px 115px,565px 60px,523px 42px,415px 27px,350px 80px,359px 224px,382px 302px,355px 381px,369px 315px,356px 242px,313px 167px,341px 182px,327px 136px,365px 145px,306px 78px,337px 53px,351px 26px,358px 5px,308px 7px);
}
.button:nth-child(1):hover ~ .block {
-webkit-clip-path: polygon(277px 16px,260px 42px,238px 43px,226px 21px,193px 6px,136px 0px,152px 50px,184px 79px,116px 154px,160px 138px,138px 178px,177px 172px,159px 234px,166px 271px,170px 308px,152px 391px,137px 420px,197px 417px,195px 388px,213px 337px,217px 380px,218px 418px,264px 419px,251px 393px,286px 391px,272px 419px,288px 419px,368px 417px,419px 369px,451px 283px,449px 190px,481px 176px,524px 198px,546px 254px,596px 221px,583px 121px,546px 59px,473px 25px,387px 17px,328px 77px,359px 224px,382px 302px,355px 381px,369px 315px,356px 242px,313px 167px,341px 182px,327px 136px,365px 145px,306px 78px,337px 53px,351px 26px,358px 5px,308px 7px);
}
.button:nth-child(2):hover ~ .block {
-webkit-clip-path: polygon(273px 16px,260px 42px,238px 43px,234px 22px,220px 2px,198px 7px,190px 37px,184px 79px,159px 102px,93px 145px,125px 192px,192px 181px,174px 237px,179px 274px,180px 314px,156px 369px,148px 407px,185px 407px,188px 361px,213px 337px,217px 380px,218px 418px,264px 419px,251px 393px,286px 391px,272px 419px,288px 419px,368px 417px,419px 369px,451px 283px,465px 236px,490px 201px,517px 260px,582px 283px,630px 234px,581px 197px,584px 85px,521px 14px,425px 8px,373px 87px,359px 224px,382px 302px,355px 381px,369px 315px,356px 242px,303px 164px,335px 159px,299px 131px,333px 132px,306px 78px,323px 39px,330px 18px,327px 4px,303px 5px);
}
.button:nth-child(3):hover ~ .block {
-webkit-clip-path: polygon(277px 16px,260px 42px,238px 43px,226px 21px,193px 6px,136px 0px,152px 50px,184px 79px,116px 154px,160px 138px,138px 178px,177px 172px,159px 234px,166px 271px,170px 308px,145px 345px,143px 392px,183px 394px,173px 362px,213px 337px,217px 380px,218px 418px,264px 419px,251px 393px,286px 391px,272px 419px,288px 419px,368px 417px,419px 369px,451px 283px,449px 190px,481px 176px,524px 198px,546px 254px,596px 221px,583px 121px,546px 59px,473px 25px,387px 17px,328px 77px,359px 224px,382px 302px,355px 381px,369px 315px,356px 242px,313px 167px,341px 182px,327px 136px,365px 145px,306px 78px,337px 53px,351px 26px,358px 5px,308px 7px);
}
.button:nth-child(4):hover ~ .block {
-webkit-clip-path: polygon(273px 16px,260px 42px,238px 43px,234px 22px,220px 2px,198px 7px,190px 37px,184px 79px,159px 102px,93px 145px,125px 192px,192px 181px,174px 237px,179px 274px,187px 324px,171px 367px,174px 405px,205px 408px,201px 372px,213px 337px,217px 380px,218px 418px,264px 419px,251px 393px,286px 391px,272px 419px,288px 419px,368px 417px,419px 369px,451px 283px,465px 236px,490px 201px,517px 260px,554px 332px,597px 278px,591px 205px,608px 86px,545px 16px,448px 2px,395px 67px,369px 164px,394px 299px,355px 381px,369px 315px,356px 242px,303px 164px,335px 159px,299px 131px,333px 132px,306px 78px,323px 39px,330px 18px,327px 4px,303px 5px);
}
Also see: Tab Triggers