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="container">
<nav class="menu">
<ul>
<input type="radio" name="menu" id="archive" checked>
<li>
<label for="archive" class="title"><i class="fa fa-folder"></i>Archive</label>
<a href="#">New File</a>
<a href="#">Open File</a>
<a href="#">Save As...</a>
<a href="#">Exit</a>
</li>
<input type="radio" name="menu" id="edit">
<li>
<label for="edit" class="title"><i class="fa fa-edit"></i>Edit</label>
<a href="#">Copy</a>
<a href="#">Cut</a>
<a href="#">Paste</a>
<a href="#">Undo</a>
</li>
<input type="radio" name="menu" id="tools">
<li>
<label for="tools" class="title"><i class="fa fa-gavel"></i>Tools</label>
<a href="#">Build</a>
<a href="#">Macros</a>
<a href="#">Command</a>
<a href="#">Snippets</a>
</li>
<input type="radio" name="menu" id="preferences">
<li>
<label for="preferences" class="title"><i class="fa fa-gears"></i>Preferences</label>
<a href="#">Browser</a>
<a href="#">Settings</a>
<a href="#">Packages</a>
<a href="#">Theme</a>
</li>
</ul>
</nav>
<main class="main">
<h1>This is a vertical accordion menu only HTML and CSS</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum itaque quae eos natus est asperiores consectetur sit, deserunt saepe totam tenetur numquam dicta harum distinctio accusamus, sed minima reiciendis expedita in. Sint, numquam recusandae id repellendus delectus porro, ipsa a harum obcaecati blanditiis cum accusantium optio voluptate dicta voluptatum. Ipsa nobis aliquid accusantium illum aliquam impedit! Sunt est aliquid ipsam sequi vel repudiandae minima alias earum facere nisi nostrum voluptatum tenetur, iusto illo harum aliquam reprehenderit porro molestias quas possimus voluptatem, doloribus, maiores ea ullam. Sint accusamus vel adipisci delectus nesciunt inventore, exercitationem saepe nulla, dignissimos cum amet consectetur odit voluptas. Laudantium corrupti modi laboriosam aspernatur sed veniam alias hic distinctio, fuga ullam incidunt blanditiis magnam recusandae numquam neque amet enim ratione! Qui numquam obcaecati quas nobis neque. Magni, autem, optio. Esse iste aut quam corrupti qui laboriosam molestias quisquam totam, non consequuntur mollitia maiores itaque et amet nisi voluptatem voluptatum sed dolorem, expedita nam aliquam. Voluptatum quisquam odio ea ullam esse exercitationem ipsum recusandae. Numquam recusandae ex ullam at nobis soluta voluptatum! Ipsum et, ipsam explicabo! Aliquid beatae commodi sint voluptatibus laborum facilis vitae, quaerat, suscipit dolore deserunt alias totam eaque blanditiis rerum, dolor voluptates itaque perferendis repudiandae similique?</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum itaque quae eos natus est asperiores consectetur sit, deserunt saepe totam tenetur numquam dicta harum distinctio accusamus, sed minima reiciendis expedita in. Sint, numquam recusandae id repellendus delectus porro, ipsa a harum obcaecati blanditiis cum accusantium optio voluptate dicta voluptatum. Ipsa nobis aliquid accusantium illum aliquam impedit! Sunt est aliquid ipsam sequi vel repudiandae minima alias earum facere nisi nostrum voluptatum tenetur, iusto illo harum aliquam reprehenderit porro molestias quas possimus voluptatem, doloribus, maiores ea ullam. Sint accusamus vel adipisci delectus nesciunt inventore, exercitationem saepe nulla, dignissimos cum amet consectetur odit voluptas. Laudantium corrupti modi laboriosam aspernatur sed veniam alias hic distinctio, fuga ullam incidunt blanditiis magnam recusandae numquam neque amet enim ratione! Qui numquam obcaecati quas nobis neque. Magni, autem, optio. Esse iste aut quam corrupti qui laboriosam molestias quisquam totam, non consequuntur mollitia maiores itaque et amet nisi voluptatem voluptatum sed dolorem, expedita nam aliquam. Voluptatum quisquam odio ea ullam esse exercitationem ipsum recusandae. Numquam recusandae ex ullam at nobis soluta voluptatum! Ipsum et, ipsam explicabo! Aliquid beatae commodi sint voluptatibus laborum facilis vitae, quaerat, suscipit dolore deserunt alias totam eaque blanditiis rerum, dolor voluptates itaque perferendis repudiandae similique?</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum itaque quae eos natus est asperiores consectetur sit, deserunt saepe totam tenetur numquam dicta harum distinctio accusamus, sed minima reiciendis expedita in. Sint, numquam recusandae id repellendus delectus porro, ipsa a harum obcaecati blanditiis cum accusantium optio voluptate dicta voluptatum. Ipsa nobis aliquid accusantium illum aliquam impedit! Sunt est aliquid ipsam sequi vel repudiandae minima alias earum facere nisi nostrum voluptatum tenetur, iusto illo harum aliquam reprehenderit porro molestias quas possimus voluptatem, doloribus, maiores ea ullam. Sint accusamus vel adipisci delectus nesciunt inventore, exercitationem saepe nulla, dignissimos cum amet consectetur odit voluptas. Laudantium corrupti modi laboriosam aspernatur sed veniam alias hic distinctio, fuga ullam incidunt blanditiis magnam recusandae numquam neque amet enim ratione! Qui numquam obcaecati quas nobis neque. Magni, autem, optio. Esse iste aut quam corrupti qui laboriosam molestias quisquam totam, non consequuntur mollitia maiores itaque et amet nisi voluptatem voluptatum sed dolorem, expedita nam aliquam. Voluptatum quisquam odio ea ullam esse exercitationem ipsum recusandae. Numquam recusandae ex ullam at nobis soluta voluptatum! Ipsum et, ipsam explicabo! Aliquid beatae commodi sint voluptatibus laborum facilis vitae, quaerat, suscipit dolore deserunt alias totam eaque blanditiis rerum, dolor voluptates itaque perferendis repudiandae similique?</p>
</main>
</div>
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700|Open+Sans:400,300);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Montserrat', sans-serif;
}
.container {
width: 100%;
height: 100%;
}
nav {
position: fixed;
display: flex;
align-items: flex-start;
width: 20%;
height: 100%;
background-color: #111;
}
main {
position: fixed;
right: 0;
width: 80%;
height: 100%;
background-color: #fff;
overflow: auto;
padding: 40px;
}
h1 {
font-weight: bold;
margin-bottom: 50px;
font-size: 55px;
text-align: center;
}
p {
margin-bottom: 20px;
line-height: 26px;
}
p::first-letter {
font-size: 200%;
font-weight: bold;
}
li, ul label.title, ul, a {
width: 100%;
color: #FFF;
font-family: 'Montserrat', 'Open Sans', sans-serif;
display: block;
font-weight: bold;
}
ul label {
height: 35px;
}
ul li{
height: 35px;
overflow: hidden;
transition: all .3s;
}
li {
display: block;
background-color: #363636;
}
label.title {
font-size: 14px;
background: linear-gradient(#111, #2f2f2f);
padding: 10px 15px;
cursor: pointer;
transition: all .25s;
}
a{
font-size: 12px;
text-decoration: none;
color: #FFF;
display: block;
padding: 10px 25px;
transition: all .25s;
}
a:hover {
background-color: #444;
box-shadow: inset 5px 0px 0px 0px #fff;
}
label:hover {
text-shadow: 0px 0px 10px #fff;
}
input[type="radio"] {
display: none;
}
#edit:checked + li, #archive:checked + li, #tools:checked + li, #preferences:checked + li {
height: 179px;
}
i {
margin-right: 12px;
}
@media screen and (max-width: 600px){
nav {
width: 100%;
position: relative;
}
main {
width: 100%;
position: relative;
}
}
Also see: Tab Triggers