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.
<!-- For sloppy testing: Add os_iOS or os_Android to <main> -->
<!-- Better to use a real device though -->
<main class=os_iOS-or-os_Android>
<h1>Hide an unsupported OS download button on mobile</h1>
<section class=btns_cnt-downloads>
<a class=dwnld_lnk-apple href>
<svg class=dwnld_img-apple aria-label="Apple app: Download from the App Store"><use xlink:href="#btn_appStore"></use></svg>
</a>
<a class=dwnld_lnk-android href>
<svg class=dwnld_img-google aria-label="Android app: Get it on Google Play"><use xlink:href="#btn_googlePlay"></use></svg>
</a>
</section>
<p>Detection script adds <code>.os_iOS</code> or <code>.os_Android</code> to the <code>html</code> element.<br>
Buttons below fake that detection purely for visualisation purposes:
</p>
<section class=btns_cnt-fakes>
<button class=fake_btn-os_iOS>Fake iOS</button>
<button class=fake_btn-os_Android>Fake Android</button>
</section>
</main>
<svg class=visually-hidden id=buttons-appStore-googlePlay>
<defs>
<symbol id="btn_appStore" width="135" height="40" fill="#FFF" viewBox="0 0 135 40">
<path fill="#000" d="M134.03 35.27c0 2.1-1.7 3.83-3.83 3.83H4.73C2.6 39.1.9 37.38.9 35.27V4.72C.9 2.62 2.6.9 4.72.9H130.2c2.12 0 3.83 1.7 3.83 3.83v30.54z"></path>
<path d="M30.13 19.78c-.03-3.22 2.64-4.8 2.76-4.86-1.53-2.2-3.87-2.5-4.7-2.53-1.96-.23-3.87 1.16-4.87 1.16-1.03 0-2.57-1.16-4.23-1.12-2.13.03-4.13 1.27-5.23 3.2-2.27 3.9-.58 9.68 1.6 12.85 1.08 1.54 2.35 3.3 4 3.22 1.63-.07 2.24-1.04 4.2-1.04 1.95 0 2.52 1.03 4.2 1 1.75-.04 2.85-1.57 3.9-3.14 1.25-1.78 1.76-3.53 1.78-3.62-.04-.02-3.4-1.3-3.42-5.16zm-3.2-9.48c.87-1.1 1.47-2.57 1.3-4.08-1.26.05-2.84.87-3.75 1.94-.8.94-1.53 2.5-1.34 3.94 1.42.1 2.88-.72 3.8-1.8zM53.65 31.5h-2.28l-1.24-3.9H45.8l-1.18 3.9h-2.2l4.27-13.3h2.63l4.3 13.3zm-3.9-5.55l-1.12-3.47c-.12-.35-.34-1.2-.67-2.5h-.04c-.13.56-.34 1.4-.63 2.5l-1.13 3.48h3.58zm14.9.65c0 1.62-.43 2.9-1.3 3.86-.8.84-1.78 1.26-2.95 1.26-1.27 0-2.17-.45-2.73-1.36h-.04v5.05H55.5V25.1c0-1.03-.03-2.08-.08-3.16h1.88l.12 1.53h.04c.7-1.15 1.8-1.72 3.23-1.72 1.12 0 2.06.46 2.82 1.35.75.9 1.13 2.08 1.13 3.54zm-2.16.07c0-.94-.23-1.7-.65-2.3-.46-.65-1.08-.96-1.86-.96-.53 0-1 .2-1.44.54-.43.35-.7.8-.84 1.37-.06.28-.1.5-.1.66v1.6c0 .7.22 1.3.65 1.77s.98.72 1.66.72c.8 0 1.43-.3 1.88-.92.46-.62.68-1.44.68-2.45zm13.2-.07c0 1.62-.44 2.9-1.33 3.86-.78.84-1.77 1.26-2.94 1.26-1.26 0-2.17-.45-2.72-1.36h-.02v5.05h-2.13V25.1c0-1.03-.03-2.08-.08-3.16h1.87l.12 1.53h.04c.7-1.15 1.78-1.72 3.23-1.72 1.13 0 2.08.46 2.84 1.35.75.9 1.13 2.08 1.13 3.54zm-2.17.07c0-.94-.2-1.7-.64-2.3-.48-.65-1.1-.96-1.87-.96-.53 0-1 .2-1.43.54-.42.35-.7.8-.83 1.37-.07.28-.1.5-.1.66v1.6c0 .7.2 1.3.64 1.77.45.48 1 .72 1.7.72.8 0 1.42-.3 1.87-.92.44-.62.67-1.44.67-2.45zm14.5 1.1c0 1.13-.4 2.05-1.17 2.77-.87.77-2.08 1.16-3.63 1.16-1.43 0-2.58-.28-3.45-.83l.5-1.78c.93.55 1.96.83 3.08.83.8 0 1.43-.18 1.88-.54.44-.37.67-.86.67-1.46 0-.54-.17-1-.54-1.37-.36-.37-.98-.7-1.83-1.03-2.33-.87-3.5-2.14-3.5-3.8 0-1.1.4-2 1.23-2.7.8-.7 1.9-1.05 3.26-1.05 1.22 0 2.22.2 3.03.62L87 20.37c-.76-.4-1.6-.6-2.55-.6-.75 0-1.34.17-1.76.54-.38.35-.55.75-.55 1.23 0 .52.2.96.6 1.3.36.32 1 .66 1.94 1.03 1.14.46 2 1 2.52 1.62.54.6.8 1.38.8 2.3zm7.07-4.27h-2.36v4.67c0 1.18.4 1.77 1.24 1.77.38 0 .7-.03.95-.1l.06 1.62c-.44.16-1 .24-1.68.24-.84 0-1.5-.26-1.98-.77-.47-.5-.7-1.38-.7-2.6V23.5h-1.4v-1.6h1.4v-1.74l2.1-.63v2.4h2.34v1.6zm10.6 3.13c0 1.47-.43 2.68-1.27 3.63-.9.97-2.06 1.46-3.52 1.46-1.4 0-2.5-.47-3.34-1.4s-1.26-2.1-1.26-3.53c0-1.5.42-2.73 1.3-3.68.85-.94 2-1.42 3.47-1.42 1.4 0 2.54.48 3.4 1.4.8.92 1.22 2.1 1.22 3.53zm-2.22.07c0-.9-.2-1.65-.57-2.28-.43-.77-1.07-1.15-1.9-1.15-.85 0-1.5.38-1.95 1.15-.4.63-.57 1.4-.57 2.32 0 .88.18 1.64.57 2.27.46.8 1.1 1.17 1.93 1.17.82 0 1.46-.4 1.92-1.17.38-.65.58-1.42.58-2.3zm9.14-2.92c-.2-.04-.44-.06-.67-.06-.75 0-1.33.3-1.74.85-.33.5-.5 1.14-.5 1.9v5.03h-2.14l.02-6.57c0-1.1-.03-2.1-.08-3.02h1.84l.08 1.86h.06c.23-.64.58-1.14 1.07-1.53.47-.34.98-.5 1.54-.5.17 0 .35 0 .5.03v2.03zm9.54 2.47c0 .38-.03.7-.08.97h-6.4c.03.95.34 1.67.93 2.17.56.43 1.26.65 2.1.65.96 0 1.8-.15 2.6-.45l.33 1.5c-.9.38-1.98.58-3.2.58-1.5 0-2.67-.44-3.52-1.3-.84-.9-1.26-2.06-1.26-3.54 0-1.44.4-2.65 1.18-3.6.84-1.03 1.96-1.55 3.37-1.55 1.37 0 2.42.5 3.13 1.52.57.82.86 1.82.86 3.02zm-2.04-.55c.02-.63-.12-1.18-.4-1.64-.38-.6-.95-.9-1.7-.9-.7 0-1.27.3-1.7.88-.36.46-.57 1-.64 1.66h4.44zM49.05 10c0 1.2-.35 2.07-1.06 2.67-.67.55-1.6.82-2.8.82-.6 0-1.1-.05-1.53-.1V7c.55-.1 1.15-.13 1.8-.13 1.15 0 2 .25 2.6.74.64.57.97 1.37.97 2.4zm-1.1.04c0-.76-.2-1.35-.6-1.76-.42-.4-1-.6-1.78-.6-.33 0-.6 0-.85.06v4.9l.7.02c.8 0 1.43-.23 1.87-.67s.64-1.1.64-1.97zm6.95 1c0 .72-.2 1.32-.6 1.78-.45.48-1.02.72-1.74.72-.7 0-1.24-.23-1.65-.7-.4-.45-.6-1.03-.6-1.72 0-.73.2-1.33.64-1.8s1-.7 1.7-.7 1.26.23 1.68.7c.4.44.6 1 .6 1.72zm-1.08.03c0-.43-.1-.8-.28-1.12-.22-.37-.53-.56-.94-.56-.42 0-.74.17-.96.54-.2.3-.28.7-.28 1.14 0 .43.1.8.28 1.1.23.4.54.57.95.57.4 0 .7-.2.92-.57.2-.32.3-.7.3-1.13zm8.95-2.35l-1.48 4.7h-.98l-.6-2.03c-.17-.54-.3-1.04-.4-1.55-.1.52-.23 1.03-.4 1.53l-.64 2.03h-.98l-1.38-4.7H57l.55 2.24c.12.53.23 1.03.32 1.5.1-.38.22-.88.4-1.5l.67-2.24h.86l.64 2.2c.15.54.28 1.06.38 1.55h.02c.08-.48.18-1 .32-1.55l.58-2.2h1.02zm5.43 4.7h-1.05v-2.7c0-.82-.32-1.23-.95-1.23-.3 0-.56.1-.76.32-.2.23-.3.5-.3.8v2.8H64.1v-3.36c0-.42 0-.87-.03-1.35H65l.04.74h.03c.12-.22.3-.4.54-.56.3-.2.6-.28.97-.28.44 0 .8.14 1.1.43.36.35.54.87.54 1.56v2.82zm2.9 0h-1.06V6.57h1.05v6.87zm6.16-2.38c0 .72-.2 1.32-.62 1.78-.44.48-1 .72-1.73.72-.67 0-1.22-.23-1.63-.7-.4-.45-.62-1.03-.62-1.72 0-.73.2-1.33.64-1.8s1-.7 1.7-.7 1.25.23 1.67.7c.4.44.6 1 .6 1.72zm-1.1.03c0-.43-.08-.8-.27-1.12-.24-.37-.55-.56-.96-.56-.42 0-.74.17-.96.54-.2.3-.3.7-.3 1.14 0 .43.1.8.3 1.1.22.4.53.57.94.57.4 0 .7-.2.94-.57.2-.32.3-.7.3-1.13zm6.17 2.36h-.94l-.1-.54h-.03c-.32.4-.78.63-1.38.63-.45 0-.8-.14-1.08-.43-.25-.24-.37-.57-.37-.95 0-.57.24-1 .72-1.32.5-.3 1.16-.45 2.04-.44v-.1c0-.63-.32-.94-.97-.94-.47 0-.88.12-1.23.35l-.2-.7c.43-.25.97-.4 1.6-.4 1.24 0 1.86.66 1.86 1.96v1.74c0 .48.02.85.07 1.13zm-1.1-1.62v-.7c-1.14-.02-1.72.3-1.72.95 0 .24.08.43.2.55.15.1.33.17.53.17.23 0 .45-.07.64-.2.2-.16.32-.35.37-.57v-.2zm7.05 1.63h-.93l-.04-.75c-.3.57-.8.86-1.53.86-.57 0-1.04-.22-1.4-.67s-.58-1.02-.58-1.73c0-.77.2-1.4.6-1.86.4-.44.88-.66 1.46-.66.63 0 1.08.22 1.33.64v-2.7h1.06v5.6c0 .46 0 .88.03 1.27zm-1.08-1.98v-.8c0-.13 0-.24-.03-.32-.06-.25-.2-.46-.38-.64-.2-.2-.45-.27-.7-.27-.4 0-.7.15-.94.46-.22.3-.34.7-.34 1.2 0 .45.1.83.32 1.12.23.3.54.47.92.47.34 0 .62-.14.83-.4.2-.24.3-.53.3-.87zm10.05-.4c0 .7-.2 1.3-.62 1.77-.44.48-1 .72-1.73.72-.7 0-1.24-.23-1.65-.7-.4-.45-.62-1.03-.62-1.72 0-.73.2-1.33.64-1.8s1-.7 1.7-.7 1.26.23 1.68.7c.4.44.6 1 .6 1.72zm-1.1.02c0-.43-.08-.8-.27-1.12-.22-.37-.53-.56-.94-.56-.42 0-.74.17-.96.54-.2.3-.28.7-.28 1.14 0 .43.1.8.28 1.1.23.4.54.57.95.57.4 0 .7-.2.94-.57.2-.32.3-.7.3-1.13zm6.73 2.36h-1.04v-2.7c0-.83-.32-1.24-.96-1.24-.3 0-.56.1-.75.32s-.3.5-.3.8v2.8H98.8v-3.36c0-.42-.02-.87-.05-1.35h.92l.05.74h.03c.12-.22.3-.4.54-.56.27-.2.6-.28.93-.28.44 0 .8.14 1.1.43.36.35.54.87.54 1.56v2.82zm7.06-3.93h-1.16v2.3c0 .58.2.87.6.87.2 0 .36-.02.48-.05l.03.8c-.23.07-.5.1-.84.1-.4 0-.73-.12-.97-.37s-.36-.67-.36-1.27V9.5h-.68v-.78h.68v-.87l1.03-.3v1.17h1.16v.78zm5.54 3.93h-1.05v-2.68c0-.84-.3-1.26-.94-1.26-.5-.03-.84.22-1 .7-.06.1-.07.24-.07.4v2.82h-1.05V6.56h1.04V9.4h.02c.33-.52.8-.78 1.4-.78.45 0 .8.14 1.1.43.35.35.52.88.52 1.58v2.8zm5.72-2.58c0 .2 0 .35-.03.48h-3.15c.02.46.17.82.46 1.06.27.2.6.3 1.03.3.48 0 .9-.06 1.3-.2l.15.72c-.44.2-.97.3-1.58.3-.73 0-1.3-.22-1.72-.65-.42-.43-.62-1-.62-1.74 0-.7.2-1.3.58-1.77.4-.5.96-.76 1.66-.76.67 0 1.2.27 1.54.77.27.4.4.9.4 1.48zm-1-.27c0-.3-.05-.58-.2-.8-.18-.3-.46-.44-.83-.44-.34 0-.62.14-.83.43-.18.22-.28.5-.32.8h2.2z"></path>
</symbol>
<symb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1-3.9zm.1 6h-2.7v-4.3h2.7c1.4 0 2.2 1.2 2.2 2.1-.1 1.1-.9 2.2-2.2 2.2zm11.5-1.8c-1.4 0-2.8.6-3.3 1.9l1.7.7c.4-.7 1-.9 1.7-.9 1 0 1.9.6 2 1.6v.1c-.3-.2-1.1-.5-1.9-.5-1.8 0-3.6 1-3.6 2.8 0 1.7 1.5 2.8 3.1 2.8 1.3 0 1.9-.6 2.4-1.2h.1v1h1.8v-4.8c-.2-2.2-1.9-3.5-4-3.5zm-.2 6.9c-.6 0-1.5-.3-1.5-1.1 0-1 1.1-1.3 2-1.3.8 0 1.2.2 1.7.4-.2 1.2-1.2 2-2.2 2zm10.5-6.6l-2.1 5.4h-.1l-2.2-5.4h-2l3.3 7.6-1.9 4.2h1.9l5.1-11.8h-2zm-16.8 8h1.9V17.5h-1.9V30z"></path>
<path fill="#00D2FF" d="M10.4 7.5c-.3.3-.5.8-.5 1.4V31c0 .6.2 1.1.5 1.4l.1.1 12.4-12.4v-.2L10.4 7.5z"></path>
<path fill="#FFBD00" d="M27 24.3l-4.1-4.1v-.3l4.1-4.1.1.1 4.9 2.8c1.4.8 1.4 2.1 0 2.9l-5 2.7z"></path>
<path fill="#FF3A44" d="M27.1 24.2L22.9 20 10.4 32.5c.5.5 1.2.5 2.1.1l14.6-8.4"></path>
<path fill="#00F076" d="M27.1 15.8L12.5 7.5c-.9-.5-1.6-.4-2.1.1L22.9 20l4.2-4.2z"></path>
</symbol>
</defs>
</svg>
[[[https://codepen.io/2kool2/pen/mKeeGM]]]
:root {
--columns: 1fr;
--gap: 1.5rem;
}
@media (min-width: 20em) {
:root {
--columns: 1fr 1fr;
--gap: 1rem;
}
}
*,
::before,
::after {
box-sizing: inherit;
}
body {
font-family: sans-serif;
line-height: 1.5;
margin: 1rem;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: hsl(269,19%,30%);
background-color: hsla(32,100%,85%,.35);
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.4'/%3E%3C/filter%3E%3C/defs%3E%3C!-- %3Cpath filter='url(%23a)' opacity='.3' d='M0 0h1200v256H0z'/%3E--%3E%3Crect filter='url(%23a)' opacity='.3' width='100%25' height='100%25'/%3E%3C/svg%3E");
}
h1 {
font-weight: 100;
line-height: 1.3;
text-align: center;
margin-bottom: .5rem;
}
p {
text-align: center;
margin: 1rem 0 .5rem;
}
code {
font-size: 16px;
text-shadow: 1px 1px #fff;
}
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
}
[class^="btns_cnt"] {
display: grid;
grid-gap: var(--gap);
grid-template-columns: var(--columns);
justify-content: center;
max-width: 330px;
margin: 0 auto;
padding: 1rem 0;
}
[class^="dwnld_lnk"] {
background-color: #000;
border-radius: 4px;
box-shadow: 0 .25em .25em rgba(0,0,0,.3);
transition: all 0.3s ease-out;
display: block;
margin: 0 auto;
text-decoration: none;
}
[class^="dwnld_lnk"]:hover,
[class^="dwnld_lnk"]:focus {
transform: scale(1.1);
box-shadow: 0 .35em .35em rgba(0,0,0,.4);
}
[class^="dwnld_img"] {
display: block;
margin: 0 auto;
width: 135px;
height: 40px;
}
/* Hide unsupported button */
:root[class^="os_"] .btns_cnt-downloads {
--columns: 1fr;
--gap: 1rem;
}
.os_Android .dwnld_lnk-apple,
.os_iOS .dwnld_lnk-android {
display: none;
}
/* Faking the OS buttons */
[class^="fake_btn"] {
font: inherit;
color: #503660;
background-color: #fff;
min-width: 98px;
border: 2px solid hsl(269,19%,30%);
padding: .5rem 1rem .25rem;
border-radius: 4px;
transition: all 0.3s ease-out;
display: block;
margin: 0 auto;
text-decoration: none;
box-shadow: 0 .25em .25em rgba(0,0,0,.3);
}
[class^="fake_btn"]:hover,
[class^="fake_btn"]:focus {
color: #418cec;
border-color: #418cec;
box-shadow: 0 .5em .5em rgba(0,0,0,.4);
}
.os_iOS .fake_btn-os_iOS,
.os_Android .fake_btn-os_Android {
background-color: lightgreen;
}
// Uses device detection to add a class to <html> but only if an Android or Apple mobile.
// Purposefully ES5
// Based on: https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system
var detect_OS_set_HTML_class = (function() {
"use strict";
var html = document.documentElement;
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent)) {
// html.className += " os_Windows";
return "Windows";
}
if (/android/i.test(userAgent)) {
html.className += " os_Android";
return "Android";
}
// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
html.className += " os_iOS";
return "iOS";
}
return "Unknown";
})();
/* Faking-up the OS buttons
Buttons add .os_iOS or .os_Android to <html> */
const fake_OS_detection_set_HTML_class_from_button = (function() {
"use strict";
const class_iOS = "os_iOS";
const class_Android = "os_Android";
const html = document.documentElement;
const buttons = document.querySelectorAll("[class*=fake_btn]");
if (!buttons) return false;
const resetHTMLClass = () => {
html.classList.remove(class_iOS, class_Android);
};
const setHTMLClass = (btn, clss, is_os) => {
if (btn.className.match(clss)) {
if (!is_os) {
html.classList.add(clss);
}
}
};
const fakeBtnClick = (event) => {
const btn = event.target;
const is_iOS = html.classList.contains(class_iOS);
const is_Android = html.classList.contains(class_Android);
resetHTMLClass();
setHTMLClass(btn, class_iOS, is_iOS);
setHTMLClass(btn, class_Android, is_Android);
};
for (let btn of buttons) {
btn.addEventListener("click", fakeBtnClick);
}
})();
Also see: Tab Triggers