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.
.grid
button: span Normal
button
button.icon
svg(width="626" height="512" viewBox="0 0 626 512" xmlns="http://www.w3.org/2000/svg")
path(fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z")
.button(role="button"): span Not focusable
.button(role="button")
.button(role="button").icon
svg(width="626" height="512" viewBox="0 0 626 512" xmlns="http://www.w3.org/2000/svg")
path(fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z")
button(disabled): span Disabled
button(disabled)
button(disabled).icon
svg(width="626" height="512" viewBox="0 0 626 512" xmlns="http://www.w3.org/2000/svg")
path(fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z")
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:600&display=swap')
$background: #f8f8f8
$button-gradient: #D8D9DB 0%, #fff 80%, #FDFDFD 100%
$button-border: #8F9092
$button-text: #606060
$highlight-bottom: 0 4px 3px 1px #FCFCFC
$shadow-bottom: 0 6px 8px #D6D7D9
$shadow-top: 0 -4px 4px #CECFD1
$highlight-top: 0 -6px 4px #FEFEFE
$shadow-inset: inset 0 0 3px 0 #CECFD1
$shadow-inset-hover: inset 0 0 3px 3px #CECFD1
$shadow-inset-focus: inset 0 0 10px 0px rgba(0, 0, 250, .6)
$shadow-inset-active: inset 0 0 5px 3px #999, inset 0 0 30px #aaa
$button-shadow-base: $highlight-bottom, $shadow-bottom, $shadow-top, $highlight-top
$button-shadow-default: $button-shadow-base, $shadow-inset
$button-shadow-hover: $button-shadow-base, $shadow-inset-hover
$button-shadow-focus: $button-shadow-base, $shadow-inset-focus
$button-shadow-active: $button-shadow-base, $shadow-inset-active
@keyframes active
from
box-shadow: $button-shadow-focus
to
box-shadow: $button-shadow-hover
*,
*:before,
*:after
box-sizing: border-box
body
margin: 0
padding: 30px
background: $background
min-height: 100vh
display: flex
align-items: center
justify-content: center
.grid
max-width: 400px
margin: 0 auto
display: grid
grid-template-columns: 150px 150px 50px
align-items: center
justify-content: center
grid-gap: 40px 25px
button,
[role="button"]
-webkit-appearance: none
user-select: none
display: flex
align-items: center
justify-content: center
outline: none
cursor: pointer
width: 150px
height: 50px
background-image: linear-gradient(to top, $button-gradient)
border-radius: 30px
border: 1px solid $button-border
box-shadow: $button-shadow-default
transition: all .2s ease
font-family: "Source Sans Pro", sans-serif
font-size: 14px
font-weight: 600
color: $button-text
text-shadow: 0 1px #fff
&::-moz-focus-inner
border: 0
& > *
transition: transform .2s ease
&:hover:not([disabled])
box-shadow: $button-shadow-hover
& > *
transform: scale(.975)
&:focus:not(:active)
animation: active .9s alternate infinite
outline: none
&:active:not([disabled])
box-shadow: $button-shadow-active
& > *
transform: scale(.95)
&:disabled
opacity: 0.6
cursor: not-allowed
&.icon
width: 50px
svg
margin-top: 3px
width: 30px
height: 30px
// Author: Jouan Marcel
// https://jouanmarcel.com
// Created for
// https://rgb.wiki/button
Also see: Tab Triggers