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.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A Storm in 2K (Taper #5)</title>
<!-- “A Storm in 2K” Copyright (C) 2020 J. R. Carpenter
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
This is from Taper #5: Pent Up, Fall 2020:
https://taper.badquart.to/5/a_storm_in_2k.html
These couplets are composed of language collected from multiple ship’s
logs recording a storm in the North Atlantic 6 February 1870. The logs
were consulted at the National Meteorological Library and Archive at
the Met Office in Exeter, UK.
-->
<style>
body { margin:0 ; overflow:hidden }
a { color:#eee ; text-decoration:none }
header { margin:0 ; padding:0 ; background-color:#444 ; color:#bbb ;
position:relative ; z-index:1000 }
header > h1 { margin:0 ; font-size:12px ; font-family:sans-serif ;
border-bottom:1px #999 solid ; padding:5px 10px ; line-height:17px }
</style>
</head>
<body>
<header id=nav>
<h1>
<del>Taper #5 :
Pent Up</del> : Fall 2020 <br>
"Sadder and Wiser" by
Timothy Wilcox <del>J.R. Carpenter</del>:
<a href="quarters.html"><<</a> —
<a href="a_square_tweets_recollections_of_spaceland.html">>></a>
</h1>
</header> <!-- The poem that follows, up to </body>, is at most 2kb -->
<style>body{background: #333;font-family: Courier New, Courier; font-size: 14pt; cursor: crosshair;}
.wrapper{width:500px;height:400px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);border-radius:5px;background-image:linear-gradient(to top,#436fa1 0%, #e7f0fd 100%);overflow:hidden;}
.wave {width:1000px;height:825px;position:absolute;top:-25%;left:50%;margin-left:-500px;margin-top:-500px;border-radius:35%;background:rgba(255, 255, 255, .175);animation:wave 15s infinite linear;}@keyframes wave{from{transform:rotate(0deg);}from{transform:rotate(360deg);}}h1{font-size:18pt;}#title{text-align:center;color:#89a4bb;}#main{margin:64pt 64pt;line-height:1.5em;}</style>
<script>
var t=0;var first='eftsoons his hand dropt he|holds him with his glittering eye|merrily did we drop|cannot chuse but hear|southward aye we fled|it grew wondrous cold|I had done a hellish thing|the silence of the sea|nor breath nor motion|upon a painted ocean|the very deep did rot|restless gossameres|with far-heard whisper|too quick for groan or sight|the rotting sea|like lead into the sea|drunken in my dreams|limbs like lifeless tools|sweet jargoning|makes the heavens be mute|moved onward from beneath|two voices in the air|mingled strangely with my fears|felt like a welcoming|dead men could not blast|forced me to begin my tale'.split('|');var second='wandered far|respect the feelings|perversity of judgement|doomed to encounter|provoked direct hostility|a portion of fear|predisposes the mind to anger|an unquiet state of mind|great pleasure|separate and insulated|plague-spots|images all a-glow|strained thought|forced diction|hazarded in the heroic couplet|despised and exploded errors|additional and important light|poetic fruitage|our common consciousness'.split('|');function rand_range(max){return Math.floor(Math.random()*(max+1));}function c(array){return array[rand_range(array.length-1)];}function story(){var main=document.getElementById('main');if(t<=0){t+=1;}else{main.removeChild(document.getElementById('main').firstChild);}last=document.createElement('div');last.appendChild(document.createTextNode(c(first)));last.appendChild(document.createElement('br'));last.appendChild(document.createTextNode(c(second)));main.appendChild(last);}function produce_stories(){story();setInterval(story,4000);}window.onload=produce_stories;</script><div id="title"><h1>1798; 1817</h1></div><div class="wrapper"><div id="main"></div><div class="wave"></div></div>
</body>
</html>
Also see: Tab Triggers