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>
<h1>Elit Bibendum</h1>
<p class="position">Etiam</p>
<p class="question">Vestibulum id ligula porta felis euismod semper?</p>
<div class="questions">
<div class="triangle-left">
<div class="inner"></div>
<div class="inner inner2"></div>
</div>
<div class="inner inner2"></div>
<p>
Donec ullamcorper nulla non metus auctor fringilla. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
<p>Aenean lacinia bibendum nulla sed consectetur. Cras mattis consectetur purus sit amet fermentum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
<blockquote>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</blockquote>
<p>
Nullam quis risus eget urna mollis ornare vel eu leo. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec id elit non mi porta gravida at eget metus.</p>
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Sed posuere consectetur est at lobortis.</p>
<p>Curabitur blandit tempus porttitor. Curabitur blandit tempus porttitor. Sed posuere consectetur est at lobortis. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>
</div>
<div class="questions full">
<p class="question full">Cras mattis consectetur purus sit amet fermentum.</p>
<div class="triangle-right">
<div class="inner"></div>
<div class="inner inner2"></div>
</div>
<p>Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas sed diam eget risus varius blandit sit amet non magna. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
<div class="triangle-left locked">
<div class="inner inner2"></div>
</div>
<p>Etiam porta sem malesuada magna mollis euismod. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Aenean lacinia bibendum nulla sed consectetur. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper.</p>
<p>Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
<blockquote> Amet Condimentum Ornare, Fusce dapibus, tellus ac cursus commodos.</blockquote>
</div>
<div class="questions three-col">
<p class="question wide">Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare veo?</p>
<p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Nullam id dolor id nibh ultricies vehicula ut id elit. Praesent
commodo cursus magna, vel scelerisque nisl consectetur et. Curabitur blandit tempus porttitor.</p>
<div class="overlay"></div>
<div class="overlay offset"></div>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Cras justo odio, dapibus ac facilisis in,
egestas eget quam. Aenean lacinia bibendum nulla sed consectetur.</p>
<blockquote>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote>
</div>
</div>
body {
background: #ce6f75;
font-family: 'PT Serif', serif;
padding: 2rem;
}
h1 {
background: #ca66ac url(https://images.unsplash.com/photo-1464982326199-86f32f81b211?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2ff8b46004acf88415bb98bb42238e9c);
background-size: 50% 200%;
background-position: bottom;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-family: 'Spirax', cursive;
font-size: 15vw;
position: relative;
text-align: left;
margin: 0;
line-height: 1.2;
&::before {
content:'Kylie Timpani';
text-align: center;
position: absolute;
z-index: -1;
}
}
.position{
font-size: 7vw;
text-align: right;
margin: 0 0 1rem 0;
color: #f6d6b5;
text-transform: uppercase;
}
div {
max-width: 800px;
margin: 0 auto;
color: #313157;
}
.question {
width: 50%;
font-weight: bold;
font-size: 1.5rem;
color: #663a70;
border-bottom: 5px solid #663a70;
&.full {
width: 55%;
}
&.wide {
width: 100%;
}
}
.questions {
border-bottom: dotted 2px #663a70;
margin-bottom: 2rem;
@media screen and (min-width: 768px) {
columns: 2;
height: 510px;
}
&.full {
columns: unset;
width: 90%;
margin: 0;
border-bottom: none;
}
&.three-col {
columns: unset;
height: auto;
margin-top: 6rem;
border-bottom: none;
position: relative;
@media screen and (min-width: 768px) {
columns: 3
}
}
}
.triangle-left {
width: 280px;
height: 280px;
shape-outside: polygon(55% 0, 0 105%, 105% 100%);
float: left;
clip-path: polygon(50% 0, 0 100%, 100% 100%);
background: #ca66ac url(https://images.unsplash.com/photo-1464982326199-86f32f81b211?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2ff8b46004acf88415bb98bb42238e9c);
background-size: cover;
&.locked {
position: relative;
clip-path: polygon(1% 0px, -1px 100.36%, 98.21% 100.36%);
shape-outside: polygon(4.93% -9px, 0px 103.93%, 105.72% 102.50%);
.inner {
clip-path: polygon(5% 21px, 12px 100.4%, 98.41% 100.79%);
}
}
}
.overlay {
bottom: 0;
left:0;
clip-path: polygon(50% 0, 0 100%, 100% 100%);
width: 100%;
height: 200%;
background: #de8f87;
position: absolute;
mix-blend-mode: overlay;
transform: rotate(180deg);
&.offset {
transform: rotate(0);
bottom: 200%;
z-index:-1;
}
}
.inner {
clip-path: polygon(50% 0, 0 100%, 100% 100%);
width: 90%;
height: 90%;
background: #ce6f75;
top: 50%;
position: relative;
transform: translateY(-50%);
}
.inner2 {
background: #cbc2a3;
position: absolute;
mix-blend-mode: overlay;
}
.inner3 {
background: #cbc2a3;
position: absolute;
mix-blend-mode: overlay;
bottom: 0;
top: 100%;
}
.triangle-right {
width: 300px;
height: 250px;
clip-path: polygon(50% 100%, 0 0, 100% 0);
shape-outside: polygon(50% 100%, 0 0, 100% 0);
float: right;
background: #ca66ac url(https://images.unsplash.com/photo-1464982326199-86f32f81b211?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2ff8b46004acf88415bb98bb42238e9c);
background-size: cover;
position: relative;
}
blockquote {
font-size: 1.2em;
font-weight: 700;
font-style: italic;
margin-left: 1rem;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
display: block;
&::before {
content: "\201C";
font-size: 5em;
transform: translate(-55px, -20px);
position: absolute;
}
}
p {
margin: 0 0 20px 0;
line-height: 1.35;
}
Also see: Tab Triggers