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 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.
<section class="grid">
<h1 class="grid__title">A <br>Grid <br>Overlap <br>Meditation</h1>
<img class="grid__image" src='https://images.unsplash.com/photo-1466951477635-f802dbe34af9?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=54a2faeacb50353b77dd9e3c862561f2' alt='A graffiti image of Einstein. Represents dangerous knowledge to tie in my with my theme'>
<img src="https://images.unsplash.com/photo-1453814235491-3cfac3999928?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=6b5bdd2d8b367203061069109a4252e6" alt="A graffiti art of a woman in pink sunglasses. Feels post-modern and ties in with the 'Punk' theme of this pen" class="grid__punk">
<h4 class="grid__subhead">punked?</h4>
<p class="grid__description">The next 3-5 years of web design are going to be an amazing era of experimentation on the web (hopefully). Reading articles by Jen Simmons and others makes me really want to coin the phrase "Punk Rock Web Design" since they look to take inspiration from the 70s and 80s of graphic design. This will be an amazing time... as long as we remember to keep things usable. This design meditation is me trying to push my boundaries of what layout is. Open up dev tools (in Firefox especially) to view the Grid layout I'm playing with.</p>
<h3 class="grid__accent-font">Is Punk Rock Design a Good Idea?</h3>
<div class="grid__promo">
<h3>Interested in more ideas like this?</h3>
<p><a href="http://twitter.com/brob/" title="Bryan Robinson's Twitter Profile">Follow me on Twitter</a> or <a href="https://bryanlrobinson.com" title="Bryan Robinson's blog and portfolio">visit my personal site</a></p>
</div>
</section>
.grid {
display: grid;
grid-template-columns: [page-start first-third-start] 0.3fr [indented-start] 1fr [description-start] 0.3fr [first-third-end] 0.8fr [second-third-end] 0.3fr 1fr [indented-end description-end] 0.3fr [page-end second-third-start];
grid-auto-rows: minmax(100px, 1fr);
align-items: start;
}
.grid__title {
grid-column: indented-start / first-third-end;
grid-row: 1 / 3;
align-self: start;
}
.grid__description {
grid-column: description;
grid-row: 3 / 5;
z-index: 10;
}
@media (max-width: 900px) {
.grid__description {
grid-row: 4 / 6;
}
}
.grid__subhead {
grid-row: 3;
grid-column: indented-start / description-start;
writing-mode: vertical-lr;
transform: rotate(180deg);
}
@media (max-width: 900px) {
.grid__subhead {
grid-row: 4;
}
}
.grid__accent-font {
grid-column: second-third;
grid-row: 2 / 4;
transform: rotate(-10deg);
position: relative;
left: -30px;
margin: 5px 0;
}
@media (max-width: 900px) {
.grid__accent-font {
left: 0;
grid-column: 1 / 7;
grid-row: 3 / 5;
align-self: start;
text-align: right;
transform: rotate(0);
}
}
.grid__promo {
grid-column: description-start / page-end;
grid-row: 5 / 6;
align-self: stretch;
}
@media (max-width: 900px) {
.grid__promo {
grid-column: 1 / 8;
grid-row: 6;
}
}
.grid__image {
z-index: -1;
grid-column: page-start / page-end;
grid-row: 1 / 5;
align-self: stretch;
width: 100%;
height: 100%;
display: block;
object-fit: cover;
align-self: stretch;
}
.grid__punk {
grid-column: first-third;
grid-row: 2 / 6;
z-index: -1;
height: 100%;
width: 100%;
object-fit: cover;
opacity: 0.9;
border-radius: 0 5px 5px 0;
}
@media (max-width: 900px) {
.grid__punk {
grid-column: 1 / 4;
grid-row: 4 / 7;
align-self: stretch;
}
}
.grid__title {
color: white;
font-size: 60px;
text-shadow: 1px 3px 0px #111;
line-height: 0.7em;
text-transform: uppercase;
}
.grid__subhead {
color: #f80759;
margin: 0;
font-size: 2.5rem;
text-shadow: -1px -1px 0 #222;
}
.grid__accent-font {
color: #f80759;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
font-size: 75px;
line-height: 1em;
font-family: cursive;
}
.grid__description {
font-size: 1.2rem;
line-height: 1.4em;
color: white;
text-shadow: 1px 1px 3px black;
}
.grid__promo {
color: #222;
padding: 20px;
background-color: #bc4e9c;
background-image: linear-gradient(
175deg,
#f80759,
#f80759 15%,
#bc4e9c 70%,
#bc4e9c
);
display: flex;
flex-direction: column;
justify-content: end;
align-items: end;
}
.grid__promo h3,
.grid__promo p {
margin: 0;
}
.grid__promo a {
color: #111;
}
.grid__promo a:hover {
color: #444;
}
.grid img {
max-width: 100%;
}
html {
font-size: 18px;
font-family: Frutiger, ‘Frutiger Linotype’, Univers, Calibri, ‘Gill Sans’,
‘Gill Sans MT’, ‘Myriad Pro’, Myriad, ‘DejaVu Sans Condensed’,
‘Liberation Sans’, ‘Nimbus Sans L’, Tahoma, Geneva, ‘Helvetica Neue’,
Helvetica, Arial, sans-serif;
line-height: 1.8em;
color: #222;
}
@media (max-width: 900px) {
html {
font-size: 16px;
}
}
body {
background-color: #f80759;
}
Also see: Tab Triggers