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.
article.o-grid
header.o-grid__area.o-header
h1.c-heading.c-heading--prim Salvador Dalí
h2.c-heading.c-heading--sec “When you are a genius, you do not have the right to die, because we are necessary for the progress of humanity.”
figure.o-grid__area.o-grid__area--media.o-media
img.o-media__img(
src='https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/Salvador_Dali_NYWTS.jpg/800px-Salvador_Dali_NYWTS.jpg'
alt='Dalí in the 1960s sporting his characteristic flamboyant moustache. Photographed holding his pet ocelot'
)
.o-grid__area.o-content
.u-col
span(aria-hidden='true').u-circled.u-float-right
p Dalí was a skilled draftsman, best known for the striking and bizarre images in his surrealist work. His expansive artistic repertoire included film, sculpture, photography, theatre, and fashion, at times in collaboration with a range of artists in a variety of media. Dalí's painterly skills are often attributed to the influence of Renaissance masters. His best-known work, The Persistence of Memory, was completed in August 1931.
.u-col
p Dalí was highly imaginative, and also enjoyed indulging in unusual and grandiose behavior. To the dismay of those who held his work in high regard, and to the irritation of his critics, his eccentric manner and attention-grabbing public actions sometimes drew more attention than his artwork.
.u-col
p Dalí employed extensive symbolism in his work. For instance, the hallmark "melting watches" that first appear in The Persistence of Memory suggest Einstein's theory that time is relative and not fixed. The idea for clocks functioning symbolically in this way came to Dalí when he was staring at a runny piece of Camembert cheese on a hot August day.
.u-col
p Dalí frequently traveled with his pet ocelot Babou, even bringing it aboard the luxury ocean liner SS France. He was also known to avoid paying tabs at restaurants by drawing on the checks he wrote. His theory was the restaurant would never want to cash such a valuable piece of art, and he was usually correct.
.u-col
p Besides visual puns, Dalí shared in the surrealist delight in verbal puns, obscure allusions, and word games. He often spoke in a bizarre combination of French, Spanish, Catalan, and English which was sometimes amusing as well as arcane.
.u-col.u-txt-right
span(aria-hidden='true').u-circled.u-float-left
p Salvador Dalí was born on May 11, 1904, in the town of Figueres, in the Empordà region, close to the French border in Catalonia, Spain. Dalí's older brother, who had also been named Salvador, had died of gastroenteritis nine months earlier, on 1 August 1903. His father, Salvador Rafael Aniceto Dalí Cusí was a middle-class lawyer and notary, an anti-clerical atheist and Catalan federalist, whose strict disciplinary approach was tempered by his wife, Felipa Domènech Ferrés, who encouraged her son's artistic endeavors.
.u-col.u-txt-right
p In August 1929, Dalí met his lifelong and primary muse and future wife Gala, born Elena Ivanovna Diakonova. She was a Russian immigrant ten years his senior, who at that time was married to surrealist poet Paul Éluard. In the same year, Dalí had important professional exhibitions and officially joined the Surrealist group in the Montparnasse quarter of Paris. His work had already been heavily influenced by surrealism for two years. The Surrealists hailed what Dalí called his paranoiac-critical method of accessing the subconscious for greater artistic creativity.
.u-col.u-txt-right
p In 1940, as World War II tore through Europe, Dalí and Gala retreated to the United States, where they lived for eight years splitting their time between New York and Monterey, California.
.u-col.u-txt-right
p On the morning of 23 January 1989, while his favorite record of Tristan and Isolde played, Dalí died of heart failure at the age of 84. He is buried in the crypt below the stage of his Theatre and Museum in Figueres. The location is across the street from the church of Sant Pere, where he had his baptism, first communion, and funeral, and is only 0.45 kilometres from the house where he was born.
footer.o-grid__area.o-footer
p
small Content adapted from Wikipedia, including text and image: https://en.wikipedia.org/wiki/Salvador_Dal%C3%AD
$dev_md_min: 35.625rem;
$dev_lg_max: 45.625rem;
$dev_lg_min: 45.688rem;
:root {
// COLOR CSS VARIABLES
--color_base: #85c1b1; // Mint
--color_mag: #ebe9e2; // Creamy
--color_headline: #aa8740; // Gold
--color_ink: #282724; // Black
// SIZE VARIABLES
--magazine: 52rem;
--img_size: 15rem;
--img_size_circled: calc(var(--img_size) / 2);
--gap: calc(var(--magazine) / 17.333333333333333);
--gap_half: calc(var(--gap) / 2);
--border: 2px;
@media screen and (min-width: $dev_md_min) {
--gap: calc(var(--magazine) / 8.666666666666667);
}
}
// MIXINS
@mixin size($w, $h: $w) {
width: $w;
height: $h;
}
// LAYOUT
body {
min-width: 20rem;
background-color: var(--color_base);
color: var(--color_ink);
font-family: 'PT Sans', sans-serif;
margin: 0;
}
figure {
margin: 0;
}
p {
font-size: 0.9rem;
line-height: 1.7;
}
::selection {
background-color: var(--color_base);
}
// UTILITY
.u-col {
// This container allows the creation of a smoother top half circular shape in text columns, and avoids paragraph columns to break on any given breakpoint.
display: inline-block;
}
.u-txt-right {
@media screen and (min-width: $dev_lg_min) {
text-align: right;
}
}
.u-circled {
border-radius: 50%;
shape-outside: circle();
@media screen and (min-width: $dev_md_min) {
@include size(calc(var(--img_size) * 1.1));
}
@media screen and (min-width: $dev_lg_min) {
@include size(var(--img_size_circled));
}
}
.u-float-right {
@media screen and (min-width: $dev_md_min) {
float: right;
}
}
.u-float-left {
@media screen and (min-width: $dev_lg_min) {
float: left;
}
}
// COMPONENTS
.c-heading {
font-family: 'Frank Ruhl Libre', serif;
font-weight: normal;
margin: 0;
&--prim {
border-bottom: var(--border) solid var(--color_ink);
color: var(--color_headline);
font-size: 3.5rem;
line-height: 0.9;
margin-bottom: 0.7rem;
padding-bottom: 1.5rem;
@media screen and (min-width: $dev_md_min) {
font-size: 6rem;
}
}
&--sec {
font-size: 1.15rem;
}
}
// OBJECTS
.o-grid {
max-width: var(--magazine);
background-color: var(--color_mag);
background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23f9f7f0' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
border-left: calc((100vw - var(--magazine)) / 2) solid var(--color_ink);
border-right: var(--border) solid var(--color_ink);
display: grid;
grid-template: auto 1fr / var(--gap) repeat(2, 1fr) var(--gap);
&__area {
grid-column: 2 / span 2;
&--media {
justify-self: center;
@media screen and (min-width: $dev_md_min) and (max-width: $dev_lg_max) {
justify-self: flex-end;
}
}
}
}
.o-header {
margin-top: var(--gap_half);
text-align: center;
}
.o-media {
@include size(var(--img_size));
border-radius: 50%;
margin-top: 2rem;
overflow: hidden;
&__img {
width: 100%;
}
}
.o-content {
columns: 15rem;
column-gap: calc(var(--gap) / 1.7);
@media screen and (min-width: $dev_md_min) {
margin-top: calc(var(--img_size_circled) * -2);
}
@media screen and (min-width: $dev_lg_min) {
margin-top: calc(var(--img_size_circled) * -1);
}
}
.o-footer {
margin-top: 2rem;
opacity: 0.2;
p {
line-height: 1.3;
word-break: break-all;
}
}
/*
* PURE CSS MAGAZINE GRID LAYOUT
* Responsive grid layout for #CodePenChallenge Art Icons.
* A tribute to Salvador Dalí.
* CSS Grid + CSS Columns + CSS Shape Outside.
*
* Design fully inspired by a real magazine.
* By ilithya | 2019
*/
Also see: Tab Triggers