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.
<section class="hero">
<div>
<div class="img">
<img class="rellax" data-rellax-speed="-5" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-1/cherry-blossoms-unsplash.jpg" alt="cherry blossoms" title="cherry blossoms">
</div>
<h1>A Tremendous Post Title</h1>
<b class="meta"><i>June 11th, 2018</i> by Writerton McWriterpants</b>
</div>
</section>
<main>
<h2>An Inspiring Subtitle</h2>
<p>Spring has sprung! In this tremendous blog article we're going to cover some points. This is where I'm telling you that what I'm going to tell you. Then I'm going to tell you those things. Then, because your special, and I'm to tell you what I told you. <b>Here comes a blockquote:</b></p>
<blockquote>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus mollis fringilla dolor, a sollicitudin turpis posuere elementum.</blockquote>
<p>That quote was from the famous latin composer... nope, just kidding. Emmet generated it because that's a feature that it has. In the next section, we're really going to get into the meat of this blog post.</p>
<h3>All the Good Stuff is in These Paragraphs</h3>
<p><i>Donec accumsan lacinia blandit</i>. Nunc ornare ante id sapien ullamcorper sollicitudin. Vestibulum vel odio sapien. Nam quis est maximus, cursus nibh at, dictum lorem. Donec vestibulum quam quis lorem egestas semper. Nullam et congue libero, a ultricies urna. Vivamus sed efficitur nisl. Fusce dapibus, lectus vel laoreet mattis, quam tellus fermentum diam, et luctus sem tortor in lorem. Nunc interdum ipsum ligula. Pellentesque sed diam erat.</p>
<p>Aliquam porta metus nec erat ullamcorper accumsan. Etiam egestas sit amet ante vitae lacinia. Donec ultricies eu nisl vel mattis. Suspendisse vestibulum sed velit lacinia imperdiet. Vivamus in nibh ullamcorper, laoreet arcu ut, gravida nulla. Curabitur in diam tempus, cursus mauris a, posuere tellus. Pellentesque purus orci, commodo non ex eu, porttitor sagittis erat. Vestibulum at orci nec turpis pharetra imperdiet quis ut urna. Donec eget accumsan tortor. In interdum mauris at velit gravida, in euismod lacus sodales. Curabitur pellentesque nunc nulla, id convallis enim eleifend vel.</p>
<p>Vivamus mollis fringilla dolor, a sollicitudin turpis posuere elementum. Quisque risus dolor, rhoncus sed imperdiet vel, tristique ac nisi. Sed dapibus aliquam nibh, at posuere dolor lobortis ac. Nam quis urna ac magna facilisis blandit. Maecenas vel arcu nec ipsum venenatis malesuada. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam semper ac sem at interdum. Ut massa est, egestas id sem at, commodo consequat velit.</p>
<h3>Some Key Takeaways</h3>
<p>After reading this tremendous blog article, these are the salient points:</p>
<ul>
<li>A bullet point</li>
<li>Another one</li>
<ol>
<li>Sub point one</li>
<li>Sub point two</li>
</ol>
<li>Another one</li>
<li>How about four?</li>
</ul>
<p>In a pellentesque eros. Morbi elementum venenatis est quis cursus. Nunc vitae mi maximus, volutpat enim nec, ultricies libero. Donec pharetra dui arcu, vel sagittis dolor scelerisque nec!</p>
<footer>
<a href="https://codetheweb.blog" target="_blank"><img src="https://codetheweb.blog/assets/img/banner.png">
</a>
</footer>
</main>
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i|Roboto+Slab:400,700');
* {
box-sizing: border-box;
/*-webkit-font-smoothing: antialiased;*/
text-rendering: optimizeLegibility;
max-width: 100%;
word-wrap: break-word;
hyphens: auto;
}
::selection {
background: hsla(341, 48%, 75%, 1);
}
:root {
font-size: 1.3em;
--body-color: #333;
--padding: 15vw;
--hero-height: 75vh;
}
body {
font-family: 'Nunito Sans', sans-serif;
color: var(--body-color);
margin: 0;
}
body > * {
padding: 0 var(--padding);
}
h1 {
font-size: 3em;
font-family: 'Roboto Slab';
mix-blend-mode: color-burn;
margin: 0.25em 0;
}
h2 {
font-size: 2em;
}
h3 {
font-size: 1.5em;
}
.img {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100vw;
z-index: -1;
opacity: 0.5;
height: calc(var(--hero-height) + 100vh);
overflow: hidden;
}
.img img {
min-height: 100%;
min-width: 100%;
max-width: unset;
}
.img, .img img {
/* For silky smooth scroll effects */
transition: all, 0.01s;
transition-timing-function: ease-in-out;
}
.hero {
height: calc(var(--hero-height) + 2.5rem);
display: flex;
align-items: flex-end;
}
blockquote {
border-left: 5px solid;
margin: 0;
padding: 1em 40px;
font-size: 1.2em;
}
blockquote:before {
content: '\00201C';
margin-right: 0.2em;
}
blockquote:after {
content: '\00201D';
margin-left: 0.2em;
}
blockquote:before, blockquote:after {
font-size: 1.5em;
vertical-align: sub;
font-weight: 900;
}
main {
line-height: 2em;
letter-spacing: 0.1px;
}
main h2:before, main h3:before {
content: '';
display: block;
width: 10%;
border-top: 0.15em solid var(--body-color);
padding-top: 1em;
}
footer {
min-height: 10em;
padding: 2em;
display: flex;
justify-content: center;
align-items: center;
}
footer img {
opacity: 0.8;
transition: opacity, 0.25s;
}
footer img:hover {
opacity: 1;
}
main {
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:cc='http://creativecommons.org/ns%23' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' id='svg2' viewBox='0 0 162.73344 95.644968' height='26.993135mm' width='45.926994mm'%3E%3Cdefs id='defs4' /%3E%3Cmetadata id='metadata7'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E%3Cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3E%3Cdc:title%3E%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cg transform='translate%28-280.83244,-424.44587%29' id='layer1'%3E%3Cpath id='path3336' d='M 282.85714,518.07649 441.5412,426.46021' style='fill:none;fill-rule:evenodd;stroke:%23000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:32, 8, 4, 8;stroke-dashoffset:0;stroke-opacity:1' /%3E%3C/g%3E%3C/svg%3E%0A");
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:cc='http://creativecommons.org/ns%23' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' id='svg2' viewBox='0 0 162.73344 191.28992' height='53.986267mm' width='45.926994mm'%3E%3Cdefs id='defs4' /%3E%3Cmetadata id='metadata7'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E%3Cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3E%3Cdc:title%3E%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cg transform='translate%28-280.83244,-424.44587%29' id='layer1'%3E%3Cpath id='path3336' d='M 282.85714,518.07649 441.5412,426.46021' style='fill:none;fill-rule:evenodd;stroke:%23000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:32, 8, 4, 8;stroke-dashoffset:0;stroke-opacity:1;opacity:0.5' /%3E%3Cpath id='path4186' d='M 327.18315,588.12982 441.5412,522.10517' style='fill:none;fill-rule:evenodd;stroke:%23000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:32, 8, 4, 8;stroke-dashoffset:0;stroke-opacity:1;opacity:0.25' /%3E%3C/g%3E%3C/svg%3E%0A");
background-size: contain;
background-position: top right;
background-size: calc(var(--padding) - 1em);
background-repeat-x: no-repeat;
background-position: calc(100vw - var(--padding) + 1em + 3px) top;
}
setTimeout(function(){var rellax = new Rellax('.rellax')},50);
window.addEventListener('scroll', function(){
document.querySelector('.img').style.opacity = (1 - window.scrollY / (window.innerHeight * 0.75)) * 0.5;
document.querySelector('.img img').style.filter = `blur(${(window.scrollY / (window.innerHeight * 0.75)) * 5}px)`;
});
Also see: Tab Triggers