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.
<main>
<h1>Full Bleed Images in Wrapper with Max Width</h1>
<article>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Risus in hendrerit gravida rutrum quisque. Nulla facilisi morbi tempus iaculis urna. Eros donec ac odio tempor orci dapibus ultrices in. Elit pellentesque habitant morbi tristique senectus et netus. Posuere morbi leo urna molestie at elementum eu facilisis. Nulla aliquet enim tortor at auctor. Enim ut sem viverra aliquet. In massa tempor nec feugiat nisl. Egestas sed tempus urna et pharetra pharetra massa massa. In egestas erat imperdiet sed euismod nisi. Nec feugiat in fermentum posuere urna nec. Aliquam purus sit amet luctus venenatis lectus magna.</p>
<p>Amet tellus cras adipiscing enim. At varius vel pharetra vel. Elit sed vulputate mi sit amet mauris. Senectus et netus et malesuada fames ac. Egestas quis ipsum suspendisse ultrices gravida dictum fusce ut placerat. Augue lacus viverra vitae congue eu. Feugiat in ante metus dictum at tempor commodo. Porttitor lacus luctus accumsan tortor. Rhoncus dolor purus non enim praesent elementum facilisis. Rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar. Nullam ac tortor vitae purus faucibus ornare suspendisse sed. Adipiscing tristique risus nec feugiat in. Commodo viverra maecenas accumsan lacus vel facilisis volutpat est. Nisl nunc mi ipsum faucibus vitae aliquet nec ullamcorper sit.</p>
<p><img class="full-bleed" src="https://images.unsplash.com/photo-1503104538136-7491acef4d5d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80" alt="iceland landscape"></p>
<p>Sit amet facilisis magna etiam tempor. Quis blandit turpis cursus in hac habitasse platea dictumst. Non blandit massa enim nec dui nunc mattis enim. Ultricies mi eget mauris pharetra et ultrices neque ornare aenean. Ac turpis egestas sed tempus. Sit amet aliquam id diam maecenas ultricies mi eget. Euismod in pellentesque massa placerat duis ultricies lacus sed. Risus nullam eget felis eget nunc lobortis mattis aliquam. Vel fringilla est ullamcorper eget nulla facilisi etiam dignissim. Ut sem viverra aliquet eget sit amet tellus. Massa sed elementum tempus egestas. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Diam donec adipiscing tristique risus nec. Morbi tincidunt ornare massa eget egestas purus viverra accumsan. Eu ultrices vitae auctor eu augue ut lectus. Tempus iaculis urna id volutpat lacus laoreet non. Morbi non arcu risus quis. Dis parturient montes nascetur ridiculus mus. Facilisis sed odio morbi quis commodo.</p>
<img class="full-bleed" src="https://images.unsplash.com/photo-1505832018823-50331d70d237?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2108&q=80" alt="scotland">
<p>Ut aliquam purus sit amet. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc. Lacus sed turpis tincidunt id. Rhoncus dolor purus non enim praesent. Consectetur a erat nam at lectus urna. Rhoncus est pellentesque elit ullamcorper dignissim. Arcu risus quis varius quam. Ut lectus arcu bibendum at varius vel pharetra vel turpis. Lacinia at quis risus sed vulputate odio ut enim blandit. Nisi vitae suscipit tellus mauris a diam maecenas sed enim.</p>
<p>Vel fringilla est ullamcorper eget nulla facilisi etiam. Elementum pulvinar etiam non quam lacus suspendisse. Vehicula ipsum a arcu cursus vitae congue mauris rhoncus. Neque volutpat ac tincidunt vitae semper quis lectus. Diam vel quam elementum pulvinar etiam non quam lacus suspendisse. Auctor urna nunc id cursus metus aliquam eleifend mi in. Venenatis a condimentum vitae sapien pellentesque habitant. Semper risus in hendrerit gravida rutrum quisque. Tortor pretium viverra suspendisse potenti nullam ac tortor. Felis imperdiet proin fermentum leo vel orci. Aliquam purus sit amet luctus venenatis lectus magna.</p>
</article>
</main>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
/*
Maybe can mofidy the
paddings to avoid horizontal
scrollbar, instead of using
this
*/
overflow-x: hidden;
}
main {
margin: 0 auto;
padding: 32px;
}
h1 {
text-align: center;
margin: 1em auto;
}
article {
width: 100%;
max-width: 680px;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
}
article > * + * {
margin-top: 1.5em;
}
img.full-bleed {
max-width: 100vw;
}
Also see: Tab Triggers