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.
.cloud.cloud-1
.cloud.cloud-2
h1 BB-8 animation with CSS
.bb8
.bb8-body
.dot.dot-1
.line.line-1
.line.line-2
.line.line-3
.dot.dot-2
.circle.circle-1
.circle.circle-2
.circle.circle-3
.body-shadow-crop
.body-shadow
.bb8-head
.head-bottom
.head-trapeze
.head-bottom-base
.head-top-crop
.head-top
.lens
.sensor
.bb8-shadow
.credit.
Original Illustration by <a href="https://dribbble.com/shots/2408834-BB-8">Justas Galaburda</a>
.sand
@import url('https://fonts.googleapis.com/css?family=Rubik:300')
// Variables
$bg: #CFEDED
$base: #EBF2FA
$head-shadow: #95C0ED
$stroke: #244356
$orange: #E78518
// Styles
*
box-sizing: border-box
body
background: $bg
font-family: 'Rubik', sans-serif
letter-spacing: 3px
text-align: center
.credit
font-size: 11px
h1
font-size: 18px
.sand
background: #B69C77
height: 200px
position: absolute
width: 100%
z-index: -1
right: 0
bottom: 0
left: 0
$d: 220px //bb8s size
.bb8
width: $d
height: $d
position: absolute
bottom: 100px
left: 40%
animation: hopMove 3s infinite 2s
.bb8-body
width: $d
height: $d
position: absolute
background: $base
border-radius: 50%
border: $d*.03 solid $stroke
overflow: hidden
animation: spinMove 1.2s linear infinite
.bb8-shadow
width: $d
height: 30px
background: rgba(0,0,0,0.25)
border-radius: 50%
top: 90%
position: relative
z-index: -1
.body-shadow-crop
width: $d
height: $d
position: absolute
border-radius: 50%
overflow: hidden
.body-shadow
width: $d
height: $d
border-radius: 50%
position: absolute
box-shadow: 0px 0px 50px rgba(0,0,0,0.4)
left: -12%
top: 5%
.circle
width: $d*.6
height: $d*.6
background-color: $orange
border-radius: 50%
border: $d*.03 solid $stroke
position: absolute
&:after
content: ''
border: $d*.03 solid $stroke
display: block
position: absolute
background: $base
width: 35%
height: 35%
top: 50%
left: 50%
border-radius: 50%
transform: translate(-50%, -50%)
.circle-1
top: 4%
left: -25%
.circle-2
top: 55%
left: 50%
.circle-3
width: $d*1.2
height: $d*1.2
top: -80%
left: 55%
.dot
background: $stroke
width: $d*.06
height: $d*.06
position: absolute
border-radius: 50%
.dot-1
top: 36%
left: 54%
.dot-2
top: 75%
left: 28%
.line
position: absolute
background: $stroke
width: $d*.015
height: $d*.6
.line-1
transform: rotate(125deg)
.line-2
transform: rotate(75deg)
bottom: -60%
.line-3
transform: rotate(10deg)
top: -60%
left: 360%
.bb8-head
width: $d*.7
height: $d*.7
position: absolute
top: -28%
left: 0%
transform: rotate(-25deg)
.sensor
height: $d*.06
width: $d*.06
border-radius: 45%
background: $stroke
top: 35%
right: 35%
position: absolute
.head-top
width: $d*.6
height: $d*.6
background: $base
border: $d*.03 solid $stroke
border-radius: 50%
box-shadow: -8px 0px 0px 3px rgba(0,0,0,0.2) inset
.head-top-crop
height: 50%
overflow: hidden
.head-trapeze
border-top: $d*.04 solid $stroke
border-left: $d*.03 solid transparent
border-right: $d*.03 solid transparent
width: 85%
top: 50%
overflow: hidden
position: absolute
.lens
width: $d*.2
height: $d*.2
background: #295A6D
border: $d*.03 solid $stroke
border-radius: 50%
position: absolute
top: 12%
left: 22%
overflow: hidden
&:after,
&:before
content: ''
display: block
width: $d*.05
height: $d*.2
background: rgba(255,255,255,0.2)
position: absolute
&:after
right: 30%
width: $d*.02
.cloud
width: 230px
height: 50px
background: #fff
position: absolute
border-radius: 200px
&:after,
&:before
content: ''
display: block
width: 130px
height: 130px
background: #fff
position: absolute
border-radius: 50%
bottom: 0
left: 33%
&:before
width: 80px
height: 80px
left: 10%
bottom: 4%
.cloud-1
right: 10%
top: 40%
.cloud-2
top: 20%
left: 10%
// Keyframes
@-webkit-keyframes spinMove
0%
transform: rotate(360deg)
100%
transform: rotate(0deg)
@-webkit-keyframes hopMove
12%
transform: translateY(0)
14%
transform: translateY(5px)
16%
transform: translateY(0)
Also see: Tab Triggers