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.
<a class="twitter">
<svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="icon-twitter" sketch:type="MSArtboardGroup" fill="#FF3B6B">
<path d="M51.1176471,17 C53.2247178,16.325 54.8511941,14.255 55.5294118,12.5 C53.6396796,12.995 51.4429935,13.88 49.6470588,14 C47.2324367,12.29 44.5685558,11 42.2941176,11 C35.9501175,11 31.356519,15.755 32,21.5 C31.356519,22.43 31.4508285,23.24 32,24.5 C23.0993587,23.57 15.5386379,19.355 9.94117647,12.5 C9.59858971,14.51 9.09367111,16.325 8.47058824,18.5 C9.09367111,21.95 10.9000609,25.19 14.3529412,27.5 C11.9766403,27.05 10.3922405,26.57 8.47058824,26 C9.00661617,31.04 12.5424973,35.33 17.2941176,36.5 C16.3743652,36.545 15.467543,36.665 14.3529412,36.5 C13.8744378,36.665 13.2316822,36.605 12.8823529,36.5 C13.9121616,40.7 17.700502,43.76 21.7058824,44 C18.6755173,46.685 14.2545776,48.38 9.94117647,48.5 C8.61777081,48.38 7.79945446,48.335 7,48.5 C11.5370129,51.245 16.9300659,53 23.1764706,53 C41.5956298,53 51.9130902,36.845 52.5882353,23 C51.9130902,22.37 51.898581,21.92 52.5882353,21.5 C53.8877862,19.97 55.625983,18.095 57,15.5 C55.1631409,16.82 53.1826412,17.39 51.1176471,17 Z"></path>
</g>
</g>
</svg>
<span>999 tweets</span>
</a>
@keyframes pop
0%
-ms-transform: scale(1)
-webkit-transform: scale(1)
transform: scale(1)
50%
-ms-transform: scale(1.2)
-webkit-transform: scale(1.2)
transform: scale(1.2)
90%
-ms-transform: scale(0.9)
-webkit-transform: scale(0.9)
transform: scale(0.9)
100%
-ms-transform: scale(1)
-webkit-transform: scale(1)
transform: scale(1)
@keyframes pulse
50%
-ms-transform: scale(1.2)
-webkit-transform: scale(1.2)
transform: scale(1.2)
opacity: 1
70%
-ms-transform: scale(0.9)
-webkit-transform: scale(0.9)
transform: scale(0.9)
opacity: 1
100%
-ms-transform: scale(1)
-webkit-transform: scale(1)
transform: scale(1)
opacity: 1
$width: 158
$height: $width
$color: #FF3B6B
.twitter
position: absolute
display: flex
flex-direction: column
justify-content: center
align-items: center
top: 50%
left: 50%
margin-left: ($width / 2) * -1px
margin-top: ($height / 2) * -1px
width: $width * 1px
height: $height * 1px
text-align: center
&:hover
#icon-twitter
fill: #fff
span
color: #fff
#icon-twitter, span
transform: translateY(-5px)
&:before
animation: pop .5s
animation-fill-mode: forwards
&:after
animation: pulse .5s
animation-fill-mode: forwards
&:before, &:after
content: ''
top: 0
left: 0
width: $width * 1px
height: $height * 1px
position: absolute
border: 1px solid $color
border-radius: 100%
&:after
background-color: $color
transform: scale(0.1)
opacity: 0
svg, span
z-index: 1
#icon-twitter
transition: 0.5s
span
transition: 0.5s
color: $color
font-size: 20px
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
Also see: Tab Triggers