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.
<body>
<div class="naccs">
<div class="grid">
<div class="gc gc--1-of-3">
<div class="menu">
<div class="active"><span class="light"></span><span>Beer</span></div>
<div><span class="light"></span><span>Wine</span></div>
<div><span class="light"></span><span>Lemonade</span></div>
</div>
</div>
<div class="gc gc--2-of-3">
<ul class="nacc">
<li class="active">
<div>
<p>Beer is the world's oldest[1][2][3] and most widely consumed[4] alcoholic drink; it is the third most popular drink overall, after water and tea.[5] The production of beer is called brewing, which involves the fermentation of sugars, mainly derived
from cereal grain starches—most commonly from malted barley, although wheat, maize (corn), and rice are widely used.[6] Most beer is flavoured with hops, which add bitterness and act as a natural preservative, though other flavourings such as
herbs or fruit may occasionally be included. The fermentation process causes a natural carbonation effect, although this is often removed during processing, and replaced with forced carbonation.[7] Some of humanity's earliest known writings refer
to the production and distribution of beer: the Code of Hammurabi included laws regulating beer and beer parlours,[8] and "The Hymn to Ninkasi", a prayer to the Mesopotamian goddess of beer, served as both a prayer and as a method of remembering
the recipe for beer in a culture with few literate people.[9][10]</p>
</div>
</li>
<li>
<div>
<p>A vine (Latin vīnea "grapevine", "vineyard", from vīnum "wine") in the narrowest sense is the grapevine (Vitis), but more generally it can refer to any plant with a growth habit of trailing or scandent (that is, climbing) stems, lianas or runners.
The word also can refer to such stems or runners themselves, for instance when used in wicker work.[1][2] In the United Kingdom, the term "vine" applies almost exclusively to the grapevine. The term "climber" is used for all climbing plants.[3]</p>
</div>
</li>
<li>
<div>
<p>Lemonade is any of various sweetened beverages found around the world, all characterized by lemon flavor. Most lemonade varieties can be separated into two distinct types: cloudy and clear; each is known simply as "lemonade" (or a cognate) in countries
where dominant.[1] Cloudy lemonade, generally found in North America and India, is a traditionally homemade drink made with lemon juice, water, and sweetener such as cane sugar or honey.[2] Found in the United Kingdom, Ireland, South Africa, Australia,
and New Zealand, clear lemonade is a lemon flavoured carbonated soft drink. Not to be confused with Sprite a lemon-lime flavored, soft drink.</p>
</div>
</li>
</ul>
</div>
</div>
</div>
</body>
@import url('https://fonts.googleapis.com/css?family=Oswald');
$base-color: #303F9F;
$second-color: #3F51B5;
$third-color: #FBC02D;
$site: #303F9F;
$light: #fff;
body {
position: relative;
font-family: 'Oswald', sans-serif;
background: $site;
color: $light;
font-size: 20px;
}
.grid {
list-style: none;
margin-left: -40px;
}
.gc {
box-sizing: border-box;
display: inline-block;
margin-right: -.25em;
min-height: 1px;
padding-left: 40px;
vertical-align: top;
}
.gc--1-of-3 {
width: 33.33333%;
}
.gc--2-of-3 {
width: 66.66666%;
}
.naccs {
position: relative;
max-width: 900px;
margin: 100px auto 0;
}
.naccs .menu div {
padding: 15px 20px 15px 40px;
margin-bottom: 10px;
color: $base-color;
background: $second-color;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
cursor: pointer;
position: relative;
vertical-align: middle;
font-weight: 700;
transition: 1s all cubic-bezier(0.075, 0.82, 0.165, 1);
}
.naccs .menu div:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.naccs .menu div span.light {
height: 10px;
width: 10px;
position: absolute;
top: 24px;
left: 15px;
background-color: $base-color;
border-radius: 100%;
transition: 1s all cubic-bezier(0.075, 0.82, 0.165, 1);
}
.naccs .menu div.active span.light {
background-color: $third-color;
left: 0;
height: 100%;
width: 3px;
top: 0;
border-radius: 0;
}
.naccs .menu div.active {
color: $third-color;
padding: 15px 20px 15px 20px;
}
ul.nacc {
position: relative;
height: 0px;
list-style: none;
margin: 0;
padding: 0;
transition: .5s all cubic-bezier(0.075, 0.82, 0.165, 1);
}
ul.nacc li {
opacity: 0;
transform: translateX(50px);
position: absolute;
list-style: none;
transition: 1s all cubic-bezier(0.075, 0.82, 0.165, 1);
}
ul.nacc li.active {
transition-delay: .3s;
z-index: 2;
opacity: 1;
transform: translateX(0px);
}
ul.nacc li p {
margin: 0;
}
// Acc
$(document).on("click", ".naccs .menu div", function() {
var numberIndex = $(this).index();
if (!$(this).is("active")) {
$(".naccs .menu div").removeClass("active");
$(".naccs ul li").removeClass("active");
$(this).addClass("active");
$(".naccs ul").find("li:eq(" + numberIndex + ")").addClass("active");
var listItemHeight = $(".naccs ul")
.find("li:eq(" + numberIndex + ")")
.innerHeight();
$(".naccs ul").height(listItemHeight + "px");
}
});
Also see: Tab Triggers