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="tags">
<strong>Tags</strong><br><br>
<span id="all"><button class="all">All</button></span>
<span id="tags">
<button class="archival">Archival</button>
<button class="ai">AI</button>
<button class="art">Art</button>
<button class="education">Education</button>
<button class="graphics">Graphics</button>
<button class="html">HTML/CSS</button>
<button class="layouts">Layouts</button>
<button class="mental">Mental Health</button>
</span>
</div>
<br>
<div id="posts">
<div class="archival">
<h3>Archival</h3>
<li><span><a href="https://www.downthemall.net/" target="_blank">DownThemAll</a><br>
Extension to allow you to download all of the images on a page</span></li>
<li><span><a href="https://github.com/johanneszab/TumblThree" target="_blank">TumblThree</a><br>
Download entire archives of Tumblr blogs</span></li>
</div>
<div class="ai">
<h3>AI</h3>
<li><span><a href="https://play.aidungeon.io/main/landing" target="_blank">AI Dungeon</a><br>
An AI-generated interactive text adventure</span></li>
<li><span><a href="https://app.inferkit.com/demo" target="_blank">Inferkit</a><br>See how a modern neural network completes your text</span></li>
<li><span><a href="https://www.boredhumans.com/" target="_blank">Bored Humans</a><br>A list of AI-generated tools.</span></li>
</div>
<div class="art"><h3>Visual Art</h3>
<li><span><a href="https://www.autodraw.com/" target="_blank">AutoDraw</a><br>
A drawing tool with the option to correct your shapes into clip-art</span></li>
<li><span><a href="https://nathanfriend.io/inspirograph/" target="_blank">Inspirograph</a><br>
Create spirograph art in your browser</span></li>
<li><span><a href="https://jspaint.app/" target="_blank">JS Paint</a><br>
Microsoft Paint in your browser - with Javascript</span></li>
<li><span><a href="https://nopaint.art/" target="_blank">NoPaint</a><br>
If you like what you see, click on "Paint", or else click "No"</span></li>
<li><span><a href="https://cheapfreedom.club/" target="_blank">Cheap Freedom</a><br>
An online visual art museum open to anyone.</span></li>
</div>
<div class="education">
<h3>Education</h3>
<li><span><a href="https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxpbnRlZ3JhbHdvbWVufGd4OjMwMTBhNGU5MTAxNTE1Mjg" target="_blank">Emotional Labor</a><br>
A comprehensive archive of a Metafilter thread about emotional labor.</span></li>
<li><span><a href="https://fs.blog/mental-models/" target="_blank">Mental Models</a><br>
A list of mental models for making intelligent decisions.</span></li>
<li><span><a href="https://untools.co/" target="_blank">Untools</a><br>
Tools for decision making and problem solving.</span></li>
</div>
<div class="graphics">
<h3>Graphics</h3>
<li><span><a href="https://boodlebox.neocities.org/award.htm" target="_blank">BoodleBox</a><br>
Fake ads to use on your page</span></li>
<li><span><a href="https://thecorporation.neocities.org/" target="_blank">The Corporation</a><br>
More fake ads to use on your page</span></li>
<li><span><a href="https://ezgif.com/" target="_blank">EZ Gif</a><br>
Create & edit gifs</span></li>
<li><span><a href="https://flamingtext.com/" target="_blank">FlamingText</a><br>
Generate word art</span></li>
<li><span><a href="https://www.makewordart.com/" target="_blank">Make Word Art</a><br>
Generate Microsoft Office-esque word art</span></li>
<li><span><a href="https://gifypet.neocities.org/" target="_blank">GIFy Pet</a><br>
Create a cute pet for your webpage</span></li>
<li><span><a href="https://photomosh.com/" target="_blank">PhotoMosh</a><br>
Add glitchy and retro effects to photos and gifs</span></li>
<li><span><a href="https://www.remove.bg/" target="_blank">Remove.bg</a><br>
Upload an image and this tool will remove the background</span></li>
<li><span><a href="https://www.richardwestenra.com/repeater/" target="_blank">Repeater</a><br>
Make your own tiled backgrounds</span></li>
<li><span><a href="https://www.toptal.com/designers/subtlepatterns/" target="_blank">SubtlePatterns</a><br>
Free background patterns</span></li>
<li><span><a href="https://web.badges.world/" target="_blank">Web Badges World</a><br>
A huge collection of web badges to display on your site</span></li>
<li><span><a href="https://blinkie.suppi.net/" target="_blank">Blinkie</a><br>
Create your own blinkies</span></li>
</div>
<div class="html"><h3>HTML/CSS</h3>
<li><span><a href="https://www.cleancss.com/css-beautify/" target="_blank">CSS Beautify</a><br>
CSS formatter</span></li>
<li><span><a href="https://codepen.io/pen/" target="_blank">CodePen</a><br>
A live editor that shows you HTML/CSS changes as you make them in real time</span></li>
<li><span><a href="http://www.constructyourcss.com/" target="_blank">Construct Your CSS</a><br>
Visually create your layout and generate the code</span></li>
<li><span><a href="http://lilaclynx.net/responsive.html" target="_blank">Lilac Lynx's Responsive Web Guide</a><br>
Guide to make your site responsive</span></li>
<li><span><a href="https://htmlcheatsheet.com/" target="_blank">HTML Cheatsheet</a><br>
A handy reference sheet when using HTML</span></li>
<li><span><a href="https://html-css-js.com/html/generator/" target="_blank">HTML Generator</a><br>
Generate the markup for lists, tables, links, images and more</span></li>
<li><span><a href="https://webguide.neocities.org/" target="_blank">WebGuide</a><br>
A good beginner's guide to HTML & CSS</span></li>
<li><span><a href="https://wordtohtml.net/" target="_blank">Word to HTML</a><br>
Paste in formatted text and generate it into HTML</span></li>
</div>
<div class="layouts"><h3>Layouts</h3>
<li><span><a href="http://www.lovelyd.shukuya.com/" target="_blank">LovelyD</a><br>
Premade 00s anime layouts</span></li>
<li><span><a href="http://celestial-star.net/" target="_blank">Celestial Star</a><br>
More 00s premade anime layouts</span></li>
<li><span><a href="https://templaterr.neocities.org/" target="_blank">Templaterr</a><br>
Premade layouts and useful site codes</span></li>
<li><span><a href="https://eggramen.neocities.org/testdirectory.html" target="_blank">EggRamen</a><br>
More free layouts</span></li>
<li><span><a href="https://www.tooplate.com/" target="_blank">TooPlate</a><br>
Modern-looking premade layouts</span></li>
</div>
<div class="mental">
<h3>Mental Health</h3>
<li><span><a href="https://emotional.codes/" target="_blank">Emotional Codes</a><br>
Tools for processing emotions</span></li>
<li><span><a href="https://feelu.now.sh/" target="_blank">Feelu Mood Wheel</a><br>
An interactive mood wheel, to help identify how you're feeling</span></li>
<li><span><a href="http://gentle.earth/" target="_blank">Gentle Earth</a><br>
Vent anonymously</span></li>
<li><span><a href="https://asmrion.com/" target="_blank">ASMRion</a><br>
ASMR Generator with various sound effects</span></li>
<li><span><a href="https://asoftmurmur.com/" target="_blank">A Soft Murmur</a><br>
Ambient sounds to wash away distraction</span></li>
<li><span><a href="https://purrli.com/" target="_blank">Purrli</a><br>
Listen to HD cat purrs as background noise</span></li>
<li><span><a href="https://rainbowhunt.com/" target="_blank">RainbowHunt</a><br>
Listen to calming rain sounds with adjustable sliders</span></li>
<li><span><a href="https://www.tree.fm/" target="_blank">Tree.fm</a><br>
Tune into forests around the world (imagery and sound effects)</span></li>
<li><span><a href="https://defonic.com/vibeocean.html">Vibe Ocean</a><br>
Ocean noise and ambient sounds generator</a><br>
<li><span><a href="https://mynoise.net/noiseMachines.php">myNoise</a><br>
A comprehensive background noise generator</a><br>
</div>
li {
list-style-type:none;
margin-bottom:18px;
}
// functionality:
// display a list of buttons which are tags at the top
// below the tags, display list of articles in div
// when a tag is clicked, hide the articles in the div and only display entry links which have a class that matches the tag
const tags = document.querySelectorAll('#tags > button');
const posts = document.querySelectorAll('#posts > div');
const displayAll = document.getElementById('all');
console.log(posts.length);
displayAll.addEventListener('click', event => {
for (let i = 0 ; i < posts.length; i++) {
posts[i].style.display = "list-item";
}
});
for (let i = 0 ; i < tags.length; i++) {
// when a tag button is clicked...
tags[i].addEventListener('click', event => {
// identify which classes belong to button
const buttonTag = tags[i].getAttribute('class');
// loop through post tags
for (let i = 0 ; i < posts.length; i++) {
// get post tags
const postTag = tags[i].getAttribute('class');
// if the "all" button is clicked, display everything
if (postTag === buttonTag) {
// display posts
posts[i].style.display = "block"
}
// if the post tag does not match the button tag...
else if (postTag != buttonTag) {
// hide the other posts
posts[i].style.display = "none"
}
}
});
}
Also see: Tab Triggers