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="text">
<div class="hidden-text">
<p>
Pie sweet roll lemon drops lemon drops bonbon. Bonbon pie chocolate cake caramels pudding lollipop. Liquorice chocolate lollipop jelly beans macaroon sweet roll. Candy canes lollipop macaroon donut cookie chocolate cake toffee fruitcake. Sweet pastry oat cake ice cream pudding candy fruitcake jelly beans apple pie.</p>
<p>Sugar plum marzipan jelly-o cotton candy bear claw danish muffin pastry. Jelly beans candy candy canes danish topping cotton candy jujubes danish. Powder candy carrot cake brownie cheesecake gummi bears toffee chocolate candy. Sugar plum sugar plum candy tiramisu tiramisu ice cream muffin. Jelly oat cake dragée chocolate cake cake candy canes jujubes apple pie.</p>
<p>Toffee cookie marzipan chocolate cake cake. Donut jelly carrot cake cake cake apple pie pastry. Shortbread chocolate bar gummi bears donut candy canes topping soufflé marzipan jujubes. Croissant candy donut chocolate gummi bears pie chocolate bar caramels gummies.
Candy gingerbread jelly chocolate bar icing ice cream pastry. Muffin tiramisu dessert dessert dragée chocolate bar donut toffee gingerbread. Cupcake lemon drops powder cake gingerbread caramels chupa chups. Ice cream dessert gummi bears candy sugar plum chupa chups sweet roll. Bear claw shortbread carrot cake tart bear claw. Carrot cake jelly cotton candy candy canes oat cake lollipop. </p><p>Liquorice chupa chups sweet chocolate cake topping sesame snaps pastry candy cake. Bear claw halvah marshmallow biscuit donut biscuit oat cake macaroon marzipan. Gingerbread soufflé jujubes tiramisu lemon drops. Marzipan wafer cookie halvah gingerbread tart bear claw biscuit donut. Donut cupcake halvah cupcake pie chocolate cake topping marzipan apple pie. Tiramisu cotton candy sweet roll dessert toffee ice cream pie sugar plum pudding. Cake bonbon dessert marzipan macaroon croissant. Powder cake powder lollipop tootsie roll chocolate.</p><p>
Chocolate soufflé dessert cake sweet roll icing macaroon. Gingerbread tootsie roll bonbon jujubes muffin biscuit lollipop oat cake. Soufflé jelly-o sweet roll soufflé dessert tiramisu bear claw marshmallow dragée. Tiramisu marshmallow cookie apple pie lemon drops caramels. Carrot cake marzipan brownie jelly beans chocolate cake shortbread wafer caramels. Sweet roll caramels pie lollipop candy donut caramels jujubes. Dessert oat cake wafer brownie ice cream. Sesame snaps dessert bear claw soufflé halvah pudding muffin bear claw jelly-o. Carrot cake wafer gummi bears dragée cupcake. Gingerbread gummi bears croissant gummi bears pudding jujubes lollipop macaroon danish. Chupa chups danish cookie chocolate bar carrot cake cotton candy. Sweet roll cupcake icing chocolate jelly beans ice cream icing.</p><p>
Icing gummies dragée lollipop brownie cotton candy shortbread. Gingerbread muffin marzipan icing candy canes macaroon croissant powder tart. Cookie fruitcake gummi bears bear claw gingerbread sweet. Jelly-o lemon drops lemon drops sweet gingerbread chupa chups marzipan icing lollipop. Toffee tiramisu candy canes liquorice gingerbread. Bear claw gummies oat cake jelly lemon drops cake. Marzipan jelly beans biscuit chocolate gingerbread icing. Chocolate bar jelly halvah cake candy chocolate cake. Candy candy canes jujubes pastry lollipop chocolate cake donut cake. Chocolate cake sweet roll gummies jelly-o liquorice dragée jujubes sweet cheesecake. Apple pie cookie sweet roll pie lollipop cookie pie chocolate cake jelly. Gummi bears shortbread chocolate cake sesame snaps lemon drops. Cake biscuit cheesecake gingerbread chocolate bar cotton candy oat cake biscuit fruitcake.
Sweet chocolate cake powder sesame snaps chocolate cake candy canes candy canes. Powder lemon drops powder jelly-o bonbon. Croissant ice cream halvah chocolate cake chocolate jelly-o jujubes. Donut fruitcake sweet roll chocolate bar icing gingerbread icing jelly.</p><p> Cheesecake halvah sweet roll sesame snaps gummi bears pudding wafer chocolate cake icing. Fruitcake topping sweet caramels oat cake cheesecake jelly beans. Dragée cotton candy wafer wafer bonbon tart oat cake. Bonbon cotton candy powder icing chocolate jujubes. Sugar plum chocolate bar tootsie roll bear claw pudding. Biscuit macaroon cotton candy topping pudding. Icing brownie dragée pastry pudding croissant liquorice marzipan. Wafer gummies cotton candy pudding halvah sweet roll. Soufflé cheesecake marshmallow cotton candy gummies cupcake.
</p>
</div>
<svg id="flashlight" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 512 512">
<g>
<path d="M384.719,0h-256C119.883,0,112,7.164,112,16v80c0,52.406,14.992,91.43,44.563,115.984 C168.914,222.242,176,236.289,176,250.508V496c0,8.836,7.883,16,16.719,16h128c8.836,0,15.281-7.164,15.281-16V250.508 c0-14.219,7.086-28.258,19.43-38.516C385.008,187.438,400,148.414,400,96V16C400,7.164,393.555,0,384.719,0z M144,32h224v48H144V32 z M335.344,187.375C315.656,203.734,304,226.75,304,250.508V480h-96V250.508c0-23.766-10.938-46.781-30.633-63.141 c-19.047-15.813-29.57-41.125-32.086-75.367h222.875C365.641,146.242,354.398,171.555,335.344,187.375z"/>
<path d="m256.719,304c17.648,0 32-14.352 32-32s-14.352-32-32-32c-17.649,0-32,14.352-32,32s14.351,32 32,32z"/>
</g>
</svg>
</div>
body {
--offset-left: 200%;
--offset-top: 200%;
background-color: #000;
.text {
position: relative;
overflow: hidden;
.hidden-text {
cursor: none;
background-color: #fff;
mask-size: 200px 200px;
mask-repeat: no-repeat;
mask-image: radial-gradient(circle, rgba(0,0,0,1) 10px, rgba(255,255,255,0) 70%);
mask-position: calc(var(--offset-left) - 100px) calc(var(--offset-top) - 100px);
}
}
}
#flashlight {
z-index: 100;
width: 60px;
height: 60px;
transform: rotate(-41deg);
position: absolute;
top: calc(var(--offset-top) + 90px);
left: calc(var(--offset-left) + 70px);
path {
fill: #444;
}
}
document.querySelector('.text').addEventListener('mousemove', function(ev){
const {pageX, pageY} = ev
document.body.style.setProperty('--offset-left', pageX + 'px')
document.body.style.setProperty('--offset-top', pageY + 'px')});
Also see: Tab Triggers