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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
<!-- Using Display -->
<p>The reef triggerfish (Rhinecanthus rectangulus), also known as the rectangular triggerfish or by its Hawaiian name <span id="fish">humuhumunukunukuāpuaʻa</span> (pronounced [ˈhumuˈhumuˈnukuˈnukuˈwaːpuˈwɐʔə], meaning 'triggerfish with a snout like a pig'[1]), also spelled humuhumunukunukuapua'a or just humuhumu for short, is one of several species of triggerfish. It is found at reefs in the Indo-Pacific[2] and is the state fish of Hawaii</p>
<p>The fish species of Hawaii inhabit the Hawaiian archipelago in the central North Pacific Ocean, southwest of the continental United States, southeast of Japan, and northeast of Australia. The islands are part of the State of Hawaii, United States. The state encompasses nearly the entire volcanic Hawaiian Island chain, which comprises hundreds of islands spread over 1,500 miles (2,400 km). At the southeastern end of the archipelago, the eight "main islands" are (from the northwest to southeast) Niʻihau, Kauaʻi, Oʻahu, Molokaʻi, Lānaʻi, Kahoʻolawe, Maui, and Hawaiʻi. The Northwestern Hawaiian Islands include many atolls, and reefs. Due to Hawaii's isolation 30% of the fish are endemic (unique to the island chain).[1]</p>
<p>In total the Hawaiian Islands comprise a total of 137 islands and atolls, with a total land area of 6,423.4 square miles (16,636.5 km2).[2] This archipelago and its oceans are physiographically and ethnologically part of the Polynesian subregion of Oceania. The climate of Hawaii is typical for a tropical area, although temperatures and humidity tend to be a bit less extreme than other tropical locales due to the constant trade winds blowing from the east.</p>
<div class="animal butterfly"></div>
<p>The surrounding waters are affected by effluents generated and released from the islands themselves. Floating plastic garbage is a problem, and refuse from the Great Pacific Garbage Patch affects its beaches. Other pressures on Hawaii's fish population are its fishing industries and whaling[3] until IWC's moratorium in 1986.[4] In the last century, some commercially fished stocks have decreased by 80-85%.[5]</p>
<figure>
<div class="animal meuble"></div>
<div class="animal bee"></div>
<div class="animal goose"></div>
<div class="animal pigeon"></div>
</figure>
<p>Due to its isolation, very few native freshwater fish species are found in Hawaii, and none are entirely restricted to freshwater (all are either anadromous, or also found in brackish and marine water in their adult stage). The seven native fish species regularly seen in fresh water are the flagtail Kuhlia xenura, the mullet Mugil cephalus, the gobies Awaous stamineus, Lentipes concolor, Sicyopterus stimpsoni and Stenogobius hawaiiensis, and the sleeper goby Eleotris sandwicensis.[6][7] Three of the gobies, A. stamineus, L. concolor and S. stimpsoni, are famous for their ability to climb waterfalls to reach higher sections of freshwater streams.[7] Several other species have been introduced to the freshwater habitats of Hawaii and some of these are invasive.</p>
<div class="animal hamster"></div>
p, figure {
max-width: 400px;
margin: auto;
margin-bottom: 2em;
}
figure {
display: flex;
flex-flow: column no-wrap;
justify-content: center;
/* background: green; */
gap: 10px;
}
#fish {
background: yellow;
display: inline;
}
.animal {
width: 100px;
height: 100px;
background-size: 100%;
background-repeat: no-repeat;
}
.hamster {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/c/cb/Meuble_h%C3%A9raldique_hamster.svg?uselang=fr');
position: fixed;
top: 200px;
left: 50%;
}
.meuble {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/2/20/Meuble_h%C3%A9raldique_Tapir.svg?uselang=fr');
position: relative;
}
.goose {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/4/4a/H%C3%A9raldique_meuble_Cygne_passant.svg?uselang=fr');
position: relative;
}
.pigeon {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/a/a2/Meuble_h%C3%A9raldique_Palombe.svg?uselang=fr');
position: relative;
}
.bee {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/0/04/Meuble_h%C3%A9raldique_Abeille_64.svg?uselang=fr');
position: relative;
}
.butterfly {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/0/05/Meuble_h%C3%A9raldique_papillon_miraill%C3%A9.svg?uselang=fr');
position: absolute;
top: 55vh;
right: 50vh;
width: 300px;
height: 300px;
}
Also see: Tab Triggers