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. You can use the CSS from another Pen by using it's URL and the proper URL extention.
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 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.
<svg class="svg">
<clipPath id="my-clip-path" clipPathUnits="objectBoundingBox"><path d="M0.5,0.957 L0.462,1,0.431,0.951,0.386,0.988,0.363,0.935,0.313,0.965,0.298,0.909,0.245,0.931,0.238,0.874,0.182,0.887,0.184,0.829,0.127,0.834,0.138,0.777,0.08,0.773,0.1,0.719,0.044,0.706,0.072,0.655,0.018,0.633,0.053,0.588,0.003,0.558,0.045,0.518,0,0.482,0.048,0.448,0.009,0.405,0.061,0.38,0.029,0.331,0.085,0.314,0.061,0.262,0.118,0.253,0.102,0.197,0.16,0.197,0.153,0.14,0.211,0.149,0.212,0.091,0.268,0.109,0.278,0.052,0.33,0.078,0.349,0.023,0.397,0.057,0.424,0.006,0.465,0.046,0.5,0,0.535,0.046,0.577,0.006,0.604,0.057,0.651,0.023,0.671,0.078,0.722,0.052,0.733,0.109,0.788,0.091,0.79,0.149,0.847,0.14,0.84,0.197,0.898,0.197,0.883,0.253,0.94,0.262,0.916,0.314,0.971,0.331,0.94,0.38,0.992,0.405,0.953,0.448,1,0.482,0.956,0.518,0.997,0.558,0.948,0.588,0.983,0.633,0.929,0.655,0.957,0.706,0.901,0.719,0.92,0.773,0.863,0.777,0.874,0.834,0.816,0.829,0.819,0.887,0.762,0.874,0.756,0.931,0.702,0.909,0.687,0.965,0.638,0.935,0.614,0.988,0.57,0.951,0.539,1"></path></clipPath>
</svg>
<div class="wrapper">
<div class="container">
<div class="header">
<h1>Cakes & drinks</h1>
</div>
<img
class="img img--cakes"
src="https://yoksel.github.io/Sandbox/img/demo/cake-jennifer-pallian.jpeg"
alt="">
<p>
Quis viverra nibh cras pulvinar mattis. Varius vel pharetra vel turpis. Orci ac auctor augue mauris augue neque. Dolor sed viverra ipsum nunc. Proin fermentum leo vel orci porta non. Velit dignissim sodales ut eu. Neque laoreet suspendisse interdum consectetur libero id.
</p>
<p>
Duis ultricies lacus sed turpis tincidunt id aliquet. Ornare aenean euismod elementum nisi quis eleifend quam adipiscing. Vitae justo eget magna fermentum iaculis eu non. Orci eu lobortis elementum nibh tellus molestie nunc. Purus in massa tempor nec. Orci dapibus ultrices in iaculis nunc. Vestibulum morbi blandit cursus risus at ultrices mi tempus imperdiet.
</p>
<p>
Vulputate eu scelerisque felis imperdiet proin fermentum leo vel. Ornare quam viverra orci sagittis eu volutpat odio. Et leo duis ut diam quam nulla porttitor. Erat velit scelerisque in dictum non. Facilisis leo vel fringilla est.
</p>
<img
class="img img--drinks"
src="https://yoksel.github.io/Sandbox/img/demo/iсed-tea-jennifer-pallian.jpeg"
alt="">
<p>
Nibh praesent tristique magna sit amet purus gravida. Diam sollicitudin tempor id eu nisl nunc. Augue mauris augue neque gravida in fermentum. Ut aliquam purus sit amet luctus venenatis lectus magna. Pulvinar pellentesque habitant morbi tristique senectus.
</p>
<p>
Ornare aenean euismod elementum nisi quis eleifend quam adipiscing. Vitae justo eget magna fermentum iaculis eu non. Orci eu lobortis elementum nibh tellus molestie nunc. Purus in massa tempor nec. Orci dapibus ultrices in iaculis nunc. Vestibulum morbi blandit cursus risus at ultrices mi tempus imperdiet.
</p>
<p>
Proin fermentum leo vel orci porta non. Velit dignissim sodales ut eu. Neque laoreet suspendisse interdum consectetur libero id. Duis ultricies lacus sed turpis tincidunt id aliquet.
</p>
</div>
</div>
@import url('https://fonts.googleapis.com/css?family=Pacifico&display=swap');
HTML, BODY {
height: 100%;
font-size: 16px;
line-height: 1.5;
font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
}
BODY {
background-color: #222;
background-image:
linear-gradient(to right, rgba(255,255,255,.025) 10%, transparent 0),
linear-gradient(to bottom, rgba(255,255,255,.025) 10%, transparent 0),
linear-gradient(#111, #000);
background-size: .75em 100%, 100% .75em, 100% 100%;
background-attachment: fixed;
display: flex;
align-items: center;
}
.svg {
position: absolute;
width: 0;
height: 0;
}
.wrapper {
margin: auto;
padding: 7rem 7rem 2rem;
}
.container {
min-width: 500px;
max-width: 900px;
padding: 2rem;
background: #FFF;
hyphens: auto;
}
P {
margin: 0;
& + & {
margin-top: 1rem;
}
}
.header {
float: left;
display: flex;
align-items: center;
justify-content: center;
margin: 2rem;
margin-top: calc(400px / -2.25 + 2rem);
margin-left: calc(400px / -2.25 + 2rem);
width: 400px;
height: 400px;
background-color: steelblue;
background-image:
linear-gradient(to right top, rgba(255,255,255,.2) 50%, transparent 0),
linear-gradient(hotpink, tomato);
background-size: 2rem 100%, 100% 100%;
// clip-path: polygon(100% 0%, 95% 50%, 100% 100%, 0% 100%, 5% 50%, 0% 0%);
// shape-outside: polygon(89% -45%, 86% -18%, 92% 56%, 0% 56%, -0% -45%);
clip-path: url(#my-clip-path);
shape-outside: polygon(-10% -10%, 87% -11%, 92% 14%, 88% 44%, 74% 71%, 51% 83%, 18% 92%, -11% 90%);
shape-margin: 1rem;
text-align: center;
color: #FFF;
}
H1 {
font-family: 'Pacifico', cursive;
font-weight: normal;
font-size: 5rem;
line-height: 1.2;
text-shadow: 2px 2px 0 rgba(0,0,0,.25);
}
.img {
display: block;
max-width: 50%;
height: auto;
shape-margin: 2rem;
}
.img--cakes {
float: right;
clear: right;
margin-top: -4rem;
margin-right: -4rem;
clip-path: polygon(36% 16%, 45% 0%, 100% 0%, 99% 100%, 72% 100%, 65% 92%, 56% 75%, 57% 62%, 43% 56%, 33% 42%, 37% 26%);
shape-outside: polygon(36% 16%, 45% 0%, 100% 0%, 99% 100%, 72% 100%, 65% 92%, 56% 75%, 57% 62%, 43% 56%, 33% 42%, 37% 26%) border-box;
}
.img--drinks {
float: left;
clear: left;
max-width: 25%;
margin-top: 1rem;
margin-left: -4rem;
clip-path: polygon(0% 0%, 30% 0%, 54% 5.14%, 76% 18%, 81% 60%, 64.79% 83%, 35% 99.29%, 0% 100%);
shape-outside: polygon(0% 0%, 30% 0%, 54% 5.14%, 76% 18%, 81% 60%, 64.79% 83%, 35% 99.29%, 0% 100%) border-box;
}
// Images: https://unsplash.com/@foodess
Also see: Tab Triggers