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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<section class="ar">
<svg viewBox="0 0 100 100">
<clipPath id="clip">
<text x="50" y="43" textLength="90" font-size="50">OMG</text>
<text x="50" y="55" textLength="90" font-size="16">PSYCHEDELIC</text>
<text x="50" y="89" textLength="90" font-size="50">SVG</text>
</clipPath>
<g clip-path="url(#clip)" id="rays">
<path id="ray01" d="M50 0V100H45L55 0z"/>
<path id="ray02" d="M40 100L60 0H65L35 100z"/>
<path id="ray03" d="M70 0L30 100H25L75 0z"/>
<path id="ray04" d="M80 0L20 100H15L85 0z"/>
<path id="ray05" d="M90 0L10 100H5L95 0z"/>
<path id="ray06" d="M100 0L0 100V95L100 5z"/>
<path id="ray07" d="M100 10L0 90V85L100 15z"/>
<path id="ray08" d="M100 20L0 80V75L100 25z"/>
<path id="ray09" d="M0 70L100 30V35L0 65z"/>
<path id="ray10" d="M0 60L100 40V45L0 55z"/>
<path id="ray11" d="M0 50H100V55L0 45z"/>
<path id="ray12" d="M100 65L0 35V40L100 60z"/>
<path id="ray13" d="M0 25L100 75V70L0 30z"/>
<path id="ray14" d="M0 20L100 80V85L0 15z"/>
<path id="ray15" d="M0 10L100 90V95L0 5z"/>
<path id="ray16" d="M0 0L100 100H95L5 0z"/>
<path id="ray17" d="M10 0L90 100H85L15 0z"/>
<path id="ray18" d="M20 0L80 100H75L25 0z"/>
<path id="ray19" d="M30 0L70 100H65L35 0z"/>
<path id="ray20" d="M60 100L40 0H45L55 100z"/>
</g>
</svg>
</section>
<aside>
<p>"Don't do this because this is just incredibly ugly".
<br/><br/>
Also:
<ul>
<li>Don't use CodePen for what it was designed for.
<li>Don't try anything new.
<li>Don't experiment.
<li>Don't imagine how you could use these ideas elsewhere.
<li>Don't have fun.
<li>also, Don't edit, misrepresent and then use this in a CSSConf talk.
</ul>
</aside>
@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro);
html {
min-height: 100%;
font-family: "Source Code Pro";
}
body {
background-color: hsl(0, 0%, 11%);
}
ar {
width: 100%;
height: 0;
padding-top: 100%;
position: relative;
}
svg {
background-color: hsl(0, 0%, 7%);
position: absolute;
top: 0;
left: 0;
}
text {
text-anchor: middle;
length-adjust: spacing;
font-weight: bold;
}
#rays > path {
fill: hsl(120, 75%, 50%);
}
#rays > path:nth-child(1) { animation: opac 1s linear .05s infinite; }
#rays > path:nth-child(3) { animation: opac 1s linear .15s infinite; }
#rays > path:nth-child(5) { animation: opac 1s linear .25s infinite; }
#rays > path:nth-child(7) { animation: opac 1s linear .35s infinite; }
#rays > path:nth-child(9) { animation: opac 1s linear .45s infinite; }
#rays > path:nth-child(11) { animation: opac 1s linear .55s infinite; }
#rays > path:nth-child(13) { animation: opac 1s linear .65s infinite; }
#rays > path:nth-child(15) { animation: opac 1s linear .75s infinite; }
#rays > path:nth-child(17) { animation: opac 1s linear .85s infinite; }
#rays > path:nth-child(19) { animation: opac 1s linear .95s infinite; }
@keyframes opac {
100% { opacity: 0; }
}
#rays > path:nth-child(even) {
fill: hsl(300, 75%, 35%);
animation: fillcol 1s steps(4) infinite alternate;
}
@keyframes fillcol {
100% { fill: hsl(170, 75%, 35%); }
}
aside {
display: none;
position: fixed;
top: 0;
background-color: hsla(0, 0%, 0%, 0.5);
color: white;
}
Also see: Tab Triggers