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 class="content">
<header>
<h1>001: Aesthetic Layouts</h1>
</header>
<main>
<div class="columns">
<div class="column">
<div class="outside">
<div class="quote-holder">
<blockquote aria-hidden="true">The joy of pixels.</blockquote>
</div>
</div>
<p>
<span class="drop"></span>
lorem ipsum dolor sit amet, consectetur adipisicing, elit. Eos,
illo! Voluptatibus eos quas quasi in enim quaerat praesentium
voluptates facilis esse, sint, laudantium similique cumque laborum
at veniam hic sit.
</p>
<p>
Ipsam quidem beatae iusto harum obcaecati expedita sint
consequuntur, necessitatibus quos accusantium aliquam, eveniet,
optio ad deserunt laudantium! Nobis molestias at sint est natus
libero modi harum iusto consequatur quisquam.
</p>
<p>
Earum, deserunt quaerat id sapiente quae debitis, atque voluptatum
vitae, sint error magni architecto rerum possimus maiores porro
aut quidem rem exercitationem. Quae quaerat reprehenderit, sit
harum repellendus provident temporibus.
</p>
<p>
Consectetur, maxime iure in, quod itaque, dolorem atque nisi
inventore assumenda maiores veritatis aliquam illo accusantium
molestiae ex vero. Quaerat qui minima aut consequuntur fugiat
fugit nihil asperiores. Laborum, fugit.
</p>
<p>
Ipsam, nam. Incidunt quas deserunt corporis ullam non qui aut ab
fugiat pariatur sunt, molestias voluptatibus iste dolorum velit
dignissimos saepe facere nihil iure quos laborum cupiditate
dolores ducimus quaerat!
</p>
</div>
<div class="column">
<div class="outside"></div>
<p>
Obcaecati, quisquam ex illum aspernatur. Necessitatibus possimus
rerum excepturi aliquid totam laboriosam reprehenderit vitae cum
tempore porro voluptas, eaque quos saepe recusandae molestiae
maiores labore modi fuga adipisci eius odit.
</p>
<p>
Cum amet recusandae doloremque aspernatur veniam eligendi magnam
laborum atque aliquid aperiam corrupti doloribus accusamus dicta
soluta eius, non, dolorum expedita voluptas libero quas obcaecati
eaque aliquam! Recusandae, ex alias.
</p>
<p>
Adipisci tenetur libero quis aspernatur at quas reiciendis beatae
ut nisi velit est dolores sunt illum dignissimos deserunt
recusandae, dolorum culpa? Sed accusantium modi labore repellendus
unde, quos dicta nulla?
</p>
<p>
Eius velit, quaerat exercitationem voluptatem officia facere
quibusdam nisi odio veritatis id rerum nesciunt et quis
perferendis modi architecto magnam similique neque. Dolores quae
aliquid officiis quaerat debitis excepturi ullam.
</p>
<p>
Deleniti quas vero perspiciatis quae placeat pariatur officia
officiis dolores dicta totam cum consequatur similique, iste
veritatis quos distinctio dolor voluptatum, odio. Cupiditate sed
doloribus provident ullam at dolorem beatae!
</p>
</div>
</div>
</main>
</div>
<a
class="bear-link"
href="https://twitter.com/intent/follow?screen_name=jh3yy"
target="_blank"
rel="noreferrer noopener"
>
<svg
class="w-9"
viewBox="0 0 969 955"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle
cx="161.191"
cy="320.191"
r="133.191"
stroke="currentColor"
stroke-width="20"
></circle>
<circle
cx="806.809"
cy="320.191"
r="133.191"
stroke="currentColor"
stroke-width="20"
></circle>
<circle
cx="695.019"
cy="587.733"
r="31.4016"
fill="currentColor"
></circle>
<circle
cx="272.981"
cy="587.733"
r="31.4016"
fill="currentColor"
></circle>
<path
d="M564.388 712.083C564.388 743.994 526.035 779.911 483.372 779.911C440.709 779.911 402.356 743.994 402.356 712.083C402.356 680.173 440.709 664.353 483.372 664.353C526.035 664.353 564.388 680.173 564.388 712.083Z"
fill="currentColor"
></path>
<rect
x="310.42"
y="448.31"
width="343.468"
height="51.4986"
fill="#FF1E1E"
></rect>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M745.643 288.24C815.368 344.185 854.539 432.623 854.539 511.741H614.938V454.652C614.938 433.113 597.477 415.652 575.938 415.652H388.37C366.831 415.652 349.37 433.113 349.37 454.652V511.741L110.949 511.741C110.949 432.623 150.12 344.185 219.845 288.24C289.57 232.295 384.138 200.865 482.744 200.865C581.35 200.865 675.918 232.295 745.643 288.24Z"
fill="currentColor"
></path>
</svg>
</a>
*,
*:after,
*:before {
box-sizing: border-box;
}
html {
color-scheme: light only;
}
body {
min-height: 100vh;
font-family: "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue", Helvetica, Arial, sans-serif, system-ui;
}
body::before {
--size: 60px;
--line: hsl(0 0% 0% / 0.15);
content: '';
height: 100vh;
width: 100vw;
position: fixed;
background: linear-gradient(
90deg,
var(--line) 1px,
transparent 1px var(--size)
)
50% 50% / var(--size) var(--size),
linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
var(--size) var(--size);
mask: linear-gradient(-15deg, transparent 30%, white);
top: 0;
transform-style: flat;
pointer-events: none;
z-index: -1;
}
h1 {
margin: 0;
font-family: monospace;
text-transform: uppercase;
}
header {
padding: 8rem 0 2rem;
}
.content {
width: 700px;
max-width: calc(100% - 2rem);
margin: 0 auto;
}
.drop {
--drop: clamp(1.5rem, 1vw + 1rem, 6rem);
height: var(--drop);
width: calc(var(--drop) * 2.25);
aspect-ratio: 4 / 3;
float: left;
position: relative;
shape-outside: inset(0 0 0 0);
}
.drop::after {
content: "CSS";
position: absolute;
inset: 0;
display: grid;
line-height: 2rem;
font-size: calc(var(--drop) * 1);
font-weight: 600;
text-align: left;
place-items: start;
}
.quote-holder {
position: absolute;
left: calc(100% + (var(--gap) * 0.5));
top: calc(var(--y) * 1%);
height: calc(var(--size) * 2px);
aspect-ratio: 1;
background: radial-gradient(white 0% 50%, transparent 70%);
translate: -50% -50%;
border-radius: 50%;
margin: 0;
font-weight: 600;
font-size: 1.5rem;
text-align: center;
container-type: inline-size;
display: grid;
place-items: center;
}
blockquote {
margin: 0;
text-align: center;
font-size: 14cqi;
}
.columns {
display: flex;
gap: var(--gap);
}
:root {
--size: 100;
--y: 200;
--x: 50;
--gap: 1rem;
}
.outside {
position: relative;
width: calc(var(--size) * 1px);
height: calc(100% + (var(--size) * 1px));
}
.column:first-of-type .outside {
float: right;
shape-outside: circle(calc(var(--size) * 1px) at 100% calc(var(--y) * 1%));
}
.column:last-of-type .outside {
float: left;
shape-outside: circle(calc(var(--size) * 1px) at 0 calc(var(--y) * 1%));
}
.columns p {
font-size: .875rem;
text-align: justify;
}
.outside {
float: right;
shape-outside: circle(50%);
}
/* Social */
.bear-link {
color: canvasText;
position: fixed;
top: 1rem;
left: 1rem;
width: 48px;
aspect-ratio: 1;
display: grid;
place-items: center;
opacity: 0.8;
}
:where(.x-link, .bear-link):is(:hover, :focus-visible) {
opacity: 1;
}
.bear-link svg {
width: 75%;
}
import { Pane } from 'https://cdn.skypack.dev/tweakpane'
const CONFIG = {
size: 120,
y: 30,
}
const CTRL = new Pane({ title: 'Configuration', expanded: false })
const update = () => {
document.documentElement.style.setProperty('--size', CONFIG.size)
document.documentElement.style.setProperty('--y', CONFIG.y)
}
CTRL.addBinding(CONFIG, 'size', { min: 50, step: 1, max: 300, label: 'Size (px)' })
CTRL.addBinding(CONFIG, 'y', { min: 0, step: 1, max: 100, label: 'Y (%)' })
CTRL.on('change', update)
update()
Also see: Tab Triggers