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 id="posterWrap">
<div id="poster">
<header>
<p>tuesday, november 26 1991<br />doors open at 7 pm / show starts at 8 pm</p>
<p>at rocky point palladium<br />warwick, ri / only 45 minutes from boston!</p>
</header>
<section class="artwork">
<h1>pixies
<span>with special guest pere ubu</span>
</h1>
<div class="svgWrapper">
<svg width="650px" viewBox="0 0 594 755" version="1.1">
<path d="M521.930891,64.4428787 C524.252685,134.300854 467.65869,183.814356 414.494173,215.785174 C361.329656,247.755992 289.320817,268.222094 261.814728,262.698874 C234.30864,257.175655 219.930459,247.695178 221.062035,215.785174 C222.193611,183.87517 233.124938,158.59607 230.147221,111.641102 C227.169504,64.6861349 218.987189,49.7932069 261.814728,25.886767 C304.642268,1.98032701 504.557619,-32.0473095 521.930891,64.4428787 Z M328.71349,175.650529 C367.113635,175.650529 398.243102,144.521061 398.243102,106.120917 C398.243102,67.720772 367.113635,36.5913043 328.71349,36.5913043 C290.313346,36.5913043 259.183878,67.720772 259.183878,106.120917 C259.183878,144.521061 290.313346,175.650529 328.71349,175.650529 Z" id="shape2"></path>
<path d="M77.9246046,350.097649 C94.0229445,305.544694 174.496979,282.492951 261.563524,277.352824 C408.130554,268.699981 594,302.564154 594,350.097649 C594,394.42949 463.372006,484.643051 364.578119,559.362823 C223.627693,665.96642 140.165398,766.093385 126.588786,754.006363 C113.012174,741.919341 138.779013,648.859528 126.588786,547.234779 C114.39856,445.610029 55.856748,411.17154 77.9246046,350.097649 Z M422.13803,473.915636 C471.245123,473.915636 511.054287,434.118158 511.054287,385.02548 C511.054287,335.932802 471.245123,296.135323 422.13803,296.135323 C373.030937,296.135323 333.221773,335.932802 333.221773,385.02548 C333.221773,434.118158 373.030937,473.915636 422.13803,473.915636 Z" id="shape3"></path>
<path d="M325.044475,120.134213 C372.858158,125.673704 438.234079,253.202101 457.521205,355.279891 C478.501007,474.389199 475.675001,623.445739 444.208226,640.591504 C412.741452,657.737268 340.568027,514.287595 238,431.05462 C135.431973,347.821645 5,276.130496 5,246.657827 C6.57553509,223.83196 78.7162997,238.021963 171.997934,200.522743 C252.584504,155.342644 277.163437,111.322585 325.044475,120.134213 Z" id="shape1"></path>
<path d="M32.9882394,664.825554 C-3.53655012,650.224916 -10.0101875,587.919684 14.9616491,502.672683 C39.9334857,417.425682 68.1450703,407 98.2284442,407 C128.311818,407 277.820621,465.560652 284.604758,497.408607 C295.791555,543.798644 66.059446,680.008813 32.9882394,664.825554
Z M66.7185267,618.763423 C93.0171394,618.763423 114.336377,597.45516 114.336377,571.170084 C114.336377,544.885009 93.0171394,523.576745 66.7185267,523.576745 C40.419914,523.576745 19.1006761,544.885009 19.1006761,571.170084 C19.1006761,597.45516 40.419914,618.763423
66.7185267,618.763423 Z" id="shape4"></path>
</svg>
</div>
</section>
</div>
</div>
<!-- This is part of the wrapper -->
<footer class="closed">
<a class="posterImage" style="background-image: url('https://cdn.shopify.com/s/files/1/0140/7312/products/pixies_2_1024x1024.jpg?v=1544640983');" href="https://www.swissted.com/products/pixies-at-rockpoint-palladium-1991"><span>Buy Poster</span></a>
<h5 id="info">#SwisstedInCode :: pixies at rockpoint palladium 1991 <i class="fa fa-question-circle" aria-hidden="true"></i></h5>
<p>The <a href="https://www.swissted.com/" target="_blank">Swissted</a> project is a collection of concert posters created in the Swiss International Style by Mike Joyce. I'm recreating Mike's beautiful print posters in code and sharing the results here.</p>
</footer>
/* ---------------------------- Basic Container ------------------*/
@import url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/10307/swissted.css');
/* ---------------------------- project specific -----------------*/
$color-text: #000014;
$color-primary: #DF1670;
$color-secondary: #17A248;
#poster {
background-color: #DBE1D5;
color: $color-text;
font-weight: 600;
letter-spacing: 0.06rem;
line-height: 1.4;
position: relative;
}
header {
padding: 2rem;
display: flex;
justify-content: space-between;
font-size: 1.2rem;
}
h1 {
font-size: 8rem;
margin-left: 1.6rem;
margin-top: 10rem;
font-weight: inherit;
line-height:1;
position: relative;
z-index: 5;
span {
display: block;
padding-left: 0.4rem;
padding-top: 1rem;
font-size: 1.2rem;
line-height: 1.4;
font-weight: 500;
}
}
.artwork {
position: absolute;
top: 8rem; bottom: 0; right:0; left:0;
}
.svgWrapper {
position: absolute;
top: 2rem;
left: 1rem;
}
#shape1, #shape4 {
fill: $color-secondary;
mix-blend-mode: multiply;
}
#shape2, #shape3 {
fill: $color-primary;
// mix-blend-mode: multiply;
}
// footer content
var clickTarg = document.getElementById('info');
var toggle = clickTarg.parentNode;
clickTarg.addEventListener('click', function () {
if (toggle.classList.contains('closed')) {
toggle.classList.remove('closed');
toggle.classList.add('open');
} else {
toggle.classList.remove('open');
toggle.classList.add('closed');
}
});
// animate SVG paths
var shape1 = ["M325.044475,120.134213 C372.858158,125.673704 438.234079,253.202101 457.521205,355.279891 C478.501007,474.389199 475.675001,623.445739 444.208226,640.591504 C412.741452,657.737268 340.568027,514.287595 238,431.05462 C135.431973,347.821645 5,276.130496 5,246.657827 C6.57553509,223.83196 78.7162997,238.021963 171.997934,200.522743 C252.584504,155.342644 277.163437,111.322585 325.044475,120.134213 Z",
"M326.5,84.1289062 C374.313683,89.6683972 470.587873,234.262054 489.875,336.339844 C510.854802,455.449152 468.675001,634.445739 437.208226,651.591504 C405.741452,668.737268 333.568027,525.287595 231,442.05462 C128.431973,358.821645 21.3203125,322.121094 21.3203125,270 C21.3203125,222.605469 71.7162997,249.021963 164.997934,211.522743 C245.584504,166.342644 278.618962,75.3172781 326.5,84.1289062 Z"];
var shape2 = ["M521.930891,64.4428787 C524.252685,134.300854 467.65869,183.814356 414.494173,215.785174 C361.329656,247.755992 289.320817,268.222094 261.814728,262.698874 C234.30864,257.175655 219.930459,247.695178 221.062035,215.785174 C222.193611,183.87517 233.124938,158.59607 230.147221,111.641102 C227.169504,64.6861349 218.987189,49.7932069 261.814728,25.886767 C304.642268,1.98032701 504.557619,-32.0473095 521.930891,64.4428787 Z M328.71349,175.650529 C367.113635,175.650529 398.243102,144.521061 398.243102,106.120917 C398.243102,67.720772 367.113635,36.5913043 328.71349,36.5913043 C290.313346,36.5913043 259.183878,67.720772 259.183878,106.120917 C259.183878,144.521061 290.313346,175.650529 328.71349,175.650529 Z","M511.759758,98.0398561 C514.081552,167.897831 468.65869,186.814356 415.494173,218.785174 C362.329656,250.755992 299.786751,266.451047 272.280662,260.927827 C244.774574,255.404608 220.930459,250.695178 222.062035,218.785174 C223.193611,186.87517 257.317673,171.002923 254.339957,124.047956 C251.36224,77.0929889 229.953001,34.0371262 272.78054,10.1306862 C315.60808,-13.7757537 494.386485,1.5496679 511.759758,98.0398561 Z M443,163 C471.166522,163 494,140.166522 494,112 C494,83.8334778 471.166522,61 443,61 C414.833478,61 392,83.8334778 392,112 C392,140.166522 414.833478,163 443,163 Z"];
var shape3 = ["M77.9246046,350.097649 C94.0229445,305.544694 174.496979,282.492951 261.563524,277.352824 C408.130554,268.699981 594,302.564154 594,350.097649 C594,394.42949 463.372006,484.643051 364.578119,559.362823 C223.627693,665.96642 140.165398,766.093385 126.588786,754.006363 C113.012174,741.919341 138.779013,648.859528 126.588786,547.234779 C114.39856,445.610029 55.856748,411.17154 77.9246046,350.097649 Z M422.13803,473.915636 C471.245123,473.915636 511.054287,434.118158 511.054287,385.02548 C511.054287,335.932802 471.245123,296.135323 422.13803,296.135323 C373.030937,296.135323 333.221773,335.932802 333.221773,385.02548 C333.221773,434.118158 373.030937,473.915636 422.13803,473.915636 Z",
"M89.359375,361.097649 C105.457715,316.544694 163.370956,275.140127 250.4375,270 C397.00453,261.347157 557,304.195299 557,361.097649 C557,418 450.625918,472.780228 351.832031,547.5 C210.881605,654.103597 133.165398,777.093385 119.588786,765.006363 C106.012174,752.919341 165.444133,636.201495 153.253906,534.576745 C141.06368,432.951996 67.2915184,422.17154 89.359375,361.097649 Z M295.721773,422.135323 C334.105563,422.135323 365.221773,391.019114 365.221773,352.635323 C365.221773,314.251533 334.105563,283.135323 295.721773,283.135323 C257.337983,283.135323 226.221773,314.251533 226.221773,352.635323 C226.221773,391.019114 257.337983,422.135323 295.721773,422.135323 Z"];
var shape4 = ["M32.9882394,664.825554 C-3.53655012,650.224916 -10.0101875,587.919684 14.9616491,502.672683 C39.9334857,417.425682 68.1450703,407 98.2284442,407 C128.311818,407 277.820621,465.560652 284.604758,497.408607 C295.791555,543.798644 66.059446,680.008813 32.9882394,664.825554 Z M66.7185267,618.763423 C93.0171394,618.763423 114.336377,597.45516 114.336377,571.170084 C114.336377,544.885009 93.0171394,523.576745 66.7185267,523.576745 C40.419914,523.576745 19.1006761,544.885009 19.1006761,571.170084 C19.1006761,597.45516 40.419914,618.763423 66.7185267,618.763423 Z",
"M75.6679687,664.25 C21.4765625,648.027344 -11.4609375,587.871094 4.9296875,526.5 C21.3203125,465.128906 78.3189699,445.945312 108.402344,445.945312 C138.485718,445.945312 250.86128,483.010911 258.411109,526.5 C269.597906,572.890038 207.738281,687.074219 75.6679687,664.25 Z M148.836377,621.576745 C186.667883,621.576745 217.336377,590.908251 217.336377,553.076745 C217.336377,515.24524 186.667883,484.576745 148.836377,484.576745 C111.004872,484.576745 80.3363773,515.24524 80.3363773,553.076745 C80.3363773,590.908251 111.004872,621.576745 148.836377,621.576745 Z"];
var isRunning = false;
document.getElementById('poster').addEventListener('mouseover', function(){
if(!isRunning){
animate();
isRunning = true;
}
})
document.getElementById('poster').addEventListener('mouseout', function(){
if(isRunning){
animate();
isRunning = false;
}
})
var animate = function(){
if(isRunning){
anime.remove(['#shape1', '#shape2', '#shape3', '#shape4']);
}
var doAnimation = anime.timeline({
duration: 1500,
elasticity: 400,
easing: 'easeOutElastic'
})
.add({
targets: '#shape1',
d: {value: isRunning ? shape1[0] : shape1[1]}
},0)
.add({
targets: '#shape2',
d: {value: isRunning ? shape2[0] : shape2[1]}
},0)
.add({
targets: '#shape3',
d: {value: isRunning ? shape3[0] : shape3[1]}
},0)
.add({
targets: '#shape4',
d: {value: isRunning ? shape4[0] : shape4[1]}
},0)
// anime({
// targets: '#shape'+num,
// d: {
// value: isRunning ? shape2[0] : shape2[1],
// duration: 1000,
// elasticity: 400,
// easing: 'easeInOutQuad',
// delay: anime.stagger(100),
// }
// })
}
Also see: Tab Triggers