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 id="content">
<section id="first">
<blockquote>
<q>All men are equal before fish.</q>
<cite>Herbert Hoover</cite>
</blockquote>
<div class="img-container">
<div class="img-mask stright-mask">
<img src="https://www.oldbookillustrations.com/wp-content/high-res/1836-1849/orbicular-batfish-1600.jpg">
</div>
<div class="img-mask inverse-mask">
<img class="inverse" src="https://www.oldbookillustrations.com/wp-content/high-res/1836-1849/orbicular-batfish-1600.jpg" />
</div>
</div>
</section>
<section id="second">
<div>
<p>A fish is any member of a group of organisms that consist of all gill-bearing aquatic craniate animals that lack limbs with digits. They form a sister group to the tunicates, together forming the olfactores. Included in this definition are the living
hagfish, lampreys, and cartilaginous and bony fish as well as various extinct related groups. Tetrapods emerged within lobe-finned fishes, so cladistically they are fish as well. However, traditionally fish are rendered obsolete or <strong>paraphyletic</strong> by excluding the tetrapods (i.e., the amphibians, reptiles, birds and mammals which all descended from within the same ancestry). Because in this manner the term "fish" is defined negatively as a paraphyletic group, it is not considered a formal
taxonomic grouping in systematic biology. The traditional term pisces (also ichthyes) is considered a typological, but not a phylogenetic classification. The earliest organisms that can be classified as fish were soft-bodied chordates that first
appeared during the Cambrian period. Although they lacked a true spine, they possessed notochords which allowed them to be more agile than their invertebrate counterparts. Fish would continue to evolve through the Paleozoic era, diversifying into
a wide variety of forms. Many fish of the Paleozoic developed external armor that protected them from predators. The first fish with jaws appeared in the Silurian period, after which many (such as sharks) became formidable marine predators rather
than just the prey of arthropods. Most fish are ectothermic ("cold-blooded"), allowing their body temperatures to vary as ambient temperatures change, though some of the large active swimmers like white shark and tuna can hold a higher core temperature.
Fish are abundant in most bodies of water. They can be found in nearly all aquatic environments, from high mountain streams (e.g., char and gudgeon) to the abyssal and even hadal depths of the deepest oceans (e.g., gulpers and anglerfish). With
33,100 described species, fish exhibit greater species diversity than any other group of vertebrates. Fish are an important resource for humans worldwide, especially as food. Commercial and subsistence fishers hunt fish in wild fisheries (see
fishing) or farm them in ponds or in cages in the ocean (see aquaculture). They are also caught by recreational fishers, kept as pets, raised by fishkeepers, and exhibited in public aquaria. Fish have had a role in culture through the ages, serving
as deities, religious symbols, and as the subjects of art, books and movies.</p>
</div>
<img class="inverse" src="https://www.oldbookillustrations.com/wp-content/high-res/1836-1849/scaly-dragonfish-864.jpg" />
</section>
</div>
@import url('https://fonts.googleapis.com/css?family=Muli:400,400i,700,700i|Ovo');
html,
body {
padding: 0;
margin: 0;
font-family: 'Ovo', serif;
font-size: 16px;
overflow-x: hidden;
line-height: 1.3em;
}
#content {
max-width: 1000px;
margin: 0 auto;
}
strong {
color: #28bfb5;
}
section {
position: relative;
}
.img-container {
position: relative;
height: 160vh;
top: 10vh;
}
img {
max-width: 100%;
}
.img-mask {
overflow: hidden;
width: 100%;
position: absolute;
}
.stright-mask {
top: 0;
height: 55%;
}
.inverse-mask {
background: rgb(26, 26, 26);
bottom: 0;
height: 45%;
}
.stright-mask img {
position: relative;
top: 100%;
transform: translateY(-55%);
}
.inverse-mask img {
object-position: bottom;
transform: translateY(-55%);
}
.inverse {
-webkit-filter: invert(0.9);
filter: invert(0.9);
}
blockquote {
color: #28bfb5;
position: absolute;
top: 0;
z-index: 1;
line-height: normal;
}
q {
font-family: 'Ovo', serif;
font-size: 50px;
}
cite {
font-style: normal;
opacity: 0.6;
display: block;
font-size: 20px;
font-family: 'Muli', sans-serif;
}
cite:before {
content: "";
background: #28bfb5;
width: 15px;
height: 2px;
display: inline-block;
margin-right: 7px;
}
q:before,
q:after {
display: none;
}
#second {
background: rgb(26, 26, 26);
}
#second p {
color: #ddd;
width: 85%;
margin: 0 auto;
text-align: justify;
position: relative;
z-index: 1;
}
#second p:first-child:first-letter {
font-size: 100px;
float: left;
line-height: 80px;
padding-right: 10px;
color: #28bfb5;
}
#second p:before,
#second p:after {
content: "";
display: block;
background: #444;
width: 4px;
height: 4px;
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
border-radius: 5px
}
#second p:after {
top: auto;
bottom: -20px;
}
#second div {
position: relative;
margin-top: 30px;
}
#second div:before {
opacity: 0.4;
content: "";
width: 300px;
height: 300px;
background: #28bfb5;
background: -webkit-radial-gradient(circle, #28bfb5 60%, transparent 60%);
display: block;
position: absolute;
bottom: -80px;
right: -80px;
z-index: 0;
}
#second .inverse {
display: block;
width: 400px;
height: auto;
position: static;
margin: 0 auto;
object-fit: contain;
padding: 40px 0;
}
#second:before {
content: "";
display: block;
width: 100%;
height: 1px;
background: #555;
position: absolute;
bottom: 160px;
}
@media (min-width: 768px) {
q {
font-size: 100px;
}
#second p {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 50px;
-moz-column-gap: 50px;
column-gap: 50px;
-webkit-column-rule: 1px solid #666;
-moz-column-rule: 1px solid #666;
column-rule: 1px solid #666;
width: 90%;
}
}
Also see: Tab Triggers