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 class="images-basic">
<div>
<img src="https://assets.codepen.io/1025350/eleanor.jpg" alt="Eleanor from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/chidi.jpg" alt="Chidi from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/jason.jpg" alt="Jason from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/tahani.jpg" alt="Tahani from The Good Place" />
</div>
</div>
<div class="images-leaning">
<div>
<img src="https://assets.codepen.io/1025350/eleanor.jpg" alt="Eleanor from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/chidi.jpg" alt="Chidi from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/jason.jpg" alt="Jason from The Good Place" />
</div>
<div>
<img src="https://assets.codepen.io/1025350/tahani.jpg" alt="Tahani from The Good Place" />
</div>
</div>
$bg-color = #eee
$card-transform = perspective(20em) rotateY(1deg) rotateZ(-5deg) skewY(-2deg) skewX(-1deg) scaleX(var(--resize))
$body-w = 800px
.images-leaning
box-sizing: border-box
width: 100%
min-width: $body-w
margin: 10em auto 0
min-height: 330px
position: relative
background-repeat: no-repeat
background-image: linear-gradient(352deg, transparent 45.2%,
#bbb 45.5%,
#bbb 45.6%,
#ccc 45.8%,
$bg-color 60.0%),
linear-gradient(30deg, #ccc, #eee 90%)
background-size: 100% 32.4em
background-position: 50% 100%
> div
width: 250px
position: absolute
left: 50%
bottom: 7.8em
z-index: 0
display: flex
justify-content: flex-end
// shadows
&:before
content: ''
width: 60%
height: 100%
position: absolute
left: 0
top: 7%
z-index: 1
background-repeat: no-repeat
background-image: linear-gradient(120deg, transparent 42%,
alpha(black,.15) 45%,
alpha(black,.35) 65%),
linear-gradient( 20deg, transparent 38%,
alpha(black,.25) 45%,
alpha(black,.23) 55%,
alpha(black,.13) 75%),
radial-gradient(ellipse at 50% 100%, alpha(black,.15) 3%, transparent 40%)
transform: rotate(-8deg)
// shading on image
&:after
content: ''
width: 60%
height: 100%
position: absolute
z-index: 3
background-image: linear-gradient(45deg, alpha(black,.3), transparent 70%),
linear-gradient(45deg, alpha(white,0) 60%, alpha(white,.3) 80%)
transform: $card-transform
> img
width: 60%
height: 100%
display: block
position: relative
z-index: 2
border-left: .2em solid
border-image: linear-gradient(105deg, transparent .5%, #aaa .7%) 1
box-shadow: .1em .2em 0 -.1em #666
filter: saturate(90%)
transform: $card-transform
&:nth-of-type(4)
--resize: .99
margin-left: -40.4em
&:before
background-size: 100% 85%, 100% 15%, 100% 10%
background-position: .1em 0, 0 100%, -3em 83%
&:nth-of-type(3)
--resize: .96
margin-left: -15.3em
transform: scaleY(.98) translate(-8em,-2.1em)
&:before
background-size: 100% 84%, 100% 16%, 100% 10%
background-position: .4em 0, 0 100%, -3em 81%
&:nth-of-type(2)
--resize: .925
margin-left: 10em
transform: scaleY(.965) translate(-17em,-4.2em)
&:before
background-size: 100% 83%, 100% 17%, 100% 10%
background-position: .6em 0, .1em 100%, -3em 81%
&:nth-of-type(1)
--resize: .895
margin-left: 35.2em
transform: scaleY(.94) translate(-26.6em,-6.2em)
&:before
background-size: 100% 82%, 100% 18%, 100% 10%
background-position: .8em 0, .1em 100%, -3em 80%
html,
body
min-height: 100vh
min-width: $body-w
body
margin: 0 auto
padding: 0
display: flex
flex-direction: column
justify-content: space-between
background-color: $bg-color
font-size: 10px
.images-basic
width: 600px
padding: 5em 0
margin: 0 auto
display: flex
justify-content: space-between
flex-direction: row-reverse
> div
width: 130px
img
width: 100%
display: block
// @lynnandtonic
// a.singlediv.com
Also see: Tab Triggers