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="boxed"></div>
// #divtober 03: Boxed
// a.singlediv.com/divtober2020
black(alpha)
rgba(0,0,0,alpha)
white(alpha)
rgba(255,255,255,alpha)
body
min-height: 400px
height: 100vh
position: relative
background-color: #fcf7f5
text-align: center
div
position: absolute
left: 50%
top: 50%
&:before,
&:after
display: block
content: ''
position: absolute
@media (max-width: 400px)
&:not(.no-scale)
transform: scale(.8)
#boxed
width: 350px
height: 300px
margin-left: -(@width/2)
margin-top: -(@height/2)
background-repeat: no-repeat
background-image: radial-gradient(circle, hotpink 60%, transparent 60.1%), // peanuts
radial-gradient(circle, pink 60%, transparent 60.1%),
radial-gradient(circle, hotpink 60%, transparent 60.1%),
radial-gradient(circle, hotpink 60%, transparent 60.1%),
radial-gradient(circle, hotpink 60%, transparent 60.1%),
radial-gradient(circle, hotpink 60%, transparent 60.1%),
radial-gradient(circle, pink 60%, transparent 60.1%),
radial-gradient(circle, hotpink 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%), // cloud
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%), // cloud
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(circle, white 60%, transparent 60.1%),
radial-gradient(ellipse at 50% 80%, transparent 35%,
mediumpurple 35.2%,
mediumpurple 40%,
darkturquoise 40.2%,
darkturquoise 45%,
mediumseagreen 45.2%,
mediumseagreen 50%,
orange 50.2%,
orange 55%,
lighten(crimson,10) 55.2%,
lighten(crimson,10) 60%,
transparent 60.2%),
radial-gradient(circle, gold 60%, transparent 60.1%),
linear-gradient(orange, orange),
linear-gradient(orange, orange),
linear-gradient(mediumpurple, mediumpurple),
linear-gradient(mediumpurple, mediumpurple),
linear-gradient(mediumseagreen, mediumseagreen),
linear-gradient(mediumseagreen, mediumseagreen),
linear-gradient(orange, orange),
linear-gradient(orange, orange)
background-size: 30px 30px, // peanuts
50px 50px,
40px 40px,
30px 30px,
30px 30px,
50px 50px,
40px 40px,
30px 30px,
20px 20px, // cloud
40px 40px,
30px 30px,
30px 30px,
20px 20px,
20px 20px, // cloud
35px 35px,
20px 20px,
25px 25px,
20px 20px,
95% 100%, // rainbow
60px 60px, // sun
21px 5px, 5px 21px,
21px 5px, 5px 21px,
21px 5px, 5px 21px,
21px 5px, 5px 21px
background-position: left 15px bottom 60px, // peanuts
left 32px bottom 53px,
left 65px bottom 54px,
left 95px bottom 60px,
right 15px bottom 60px,
right 32px bottom 53px,
right 65px bottom 54px,
right 95px bottom 60px,
72px 100px, // cloud
82px 80px,
110px 90px,
82px 100px,
105px 105px,
right 50px top 150px, // cloud
right 60px top 140px,
right 85px top 155px,
right 70px top 160px,
right 55px top 160px,
50% 0, // rainbow
right 20px top, // sun
0 148px, 8px 140px,
70px 35px, 78px 27px,
140px 180px, 148px 172px,
right 10px top 115px, right 18px top 107px
&:before,
&:after
font-family: Helvetica, Arial, sans-erif
font-weight: bold
text-transform: uppercase
font-size: 11px
color: #222
height: 30px
padding-top: 50px
bottom: 0
background-repeat: no-repeat
background-size: 33% 30%,
33% 40%,
70% 30%,
60% 40%,
112px 100%
box-shadow: 0 15px 0 -13px sienna
&:before
content: 'design'
text-align: right
width: 110px
padding-right: 35px
background-image: linear-gradient(120deg, transparent 21%,
darken(peru,10) 21.5%,
darken(peru,10) 78%,
transparent 78.5%),
linear-gradient(110deg, darken(peru,23) 55%,
transparent 55.5%),
linear-gradient( 55deg, transparent 18%,
peru 18.5%,
peru 85%,
transparent 85.5%),
linear-gradient( 70deg, transparent 19%,
darken(peru,15) 19.5%),
linear-gradient(to right, darken(peru,15) 29%, lighten(peru,5) 29%)
background-position: 0 0,
15px 0,
100% 0,
right 18px top 0,
15px 0
&:after
content: 'code'
text-align: left
width: 105px
padding-left: 40px
right: 0
background-image: linear-gradient(-120deg, transparent 21%,
darken(peru,10) 21.5%,
darken(peru,10) 78%,
transparent 78.5%),
linear-gradient(-110deg, darken(peru,23) 55%,
transparent 55.5%),
linear-gradient( -55deg, transparent 18%,
peru 18.5%,
peru 85%,
transparent 85.5%),
linear-gradient( -70deg, transparent 19%,
darken(peru,15) 19.5%),
linear-gradient(to left, darken(peru,15) 29%, lighten(peru,5) 29%)
background-position: 100% 0,
right 15px top 0,
0 0,
left 18px top 0,
right 15px top 0
// @lynnandtonic
// a.singlediv.com
Also see: Tab Triggers