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 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.
<input type="checkbox" id="menu" />
<label for="menu" class="menu">
<span></span>
<span></span>
<span></span>
</label>
<nav class="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Works</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<main>
<header>
<h1><i class="fa fa-picture-o" aria-hidden="true"></i></h1>
</header>
<section>
<div class="container">
<p>Busey ipsum dolor sit amet. You ever roasted doughnuts?I wrestled a bear once. A 750lbs black bear.The best way to communicate is compatible. Compatible communication is listening with open ears and an open mind, and not being fearful or judgemental about what you're hearing. It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs. Have you urinated? Have you drained your bladder? Are you free? Because if you haven't it will only come out later. I'm giving you some information that your bodily fluids may penetrate your clothing fibre's without warning. Did you feel that? Look at me - I'm not out of breath anymore!</p>
<p>When you get lost in your imaginatory vagueness, your foresight will become a nimble vagrant. It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs. Go with the feeling of the nature. Take it easy. Know why you're here. And remember to balance your internal energy with the environment.</p>
<p>It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs. You gotta go through it to see there ain't nothing to it. The magic Indian is a mysterious spiritual force, and we're going to Cathedral Rock, and that's the vortex of the heart. These kind of things only happen for the first time once. I would like to give you a backstage pass to my imagination. When you get lost in your imaginatory vagueness, your foresight will become a nimble vagrant. It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs.</p>
</div>
</section>
<div class="img">
<h1><i class="fa fa-picture-o" aria-hidden="true"></i></h1>
</div>
<section>
<div class="container">
<p>Have you urinated? Have you drained your bladder? Are you free? Because if you haven't it will only come out later. I'm giving you some information that your bodily fluids may penetrate your clothing fibre's without warning. Did you feel that? Look at me - I'm not out of breath anymore! When you get lost in your imaginatory vagueness, your foresight will become a nimble vagrant. It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs. Go with the feeling of the nature. Take it easy. Know why you're here. And remember to balance your internal energy with the environment.</p>
<p>Busey ipsum dolor sit amet. You ever roasted doughnuts? I wrestled a bear once. A 750lbs black bear. The best way to communicate is compatible.</p>
<p>It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs. You gotta go through it to see there ain't nothing to it. The magic Indian is a mysterious spiritual force, and we're going to Cathedral Rock, and that's the vortex of the heart. Compatible communication is listening with open ears and an open mind, and not being fearful or judgemental about what you're hearing. It's OK to get Rib-grease on your face, because you're allowing people to see that you're proud of these ribs.</p>
</div>
</section>
<footer>
<div class="logo">
<i class="fa fa-picture-o" aria-hidden="true"></i>
</div>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Works</a></li>
<li><a href="#">Contact</a></li>
</ul>
<div class="secondary-links">
<ul>
<li><a href="#">Terms and Conditions</a></li>
<li><a href="#">Privacy Policy</a></li>
</ul>
<ul class="social">
<li><a href="#">
<i class="fa fa-github"></i>
</a></li>
<li><a href="#">
<i class="fa fa-twitter"></i>
</a></li>
<li><a href="#">
<i class="fa fa-codepen"></i>
</a></li>
</ul>
</div>
</footer>
</main>
@import "bourbon";
@import "neat";
$base-duration: 500ms;
// Colors
$color-1: #444;
$color-2: #3498db;
$color-3: #2ecc71;
// Breakpoints
$sm: new-breakpoint(min-width 320px);
$med: new-breakpoint(min-width 768px);
$lg: new-breakpoint(min-width 1024px);
*, *:before, *:after {
box-sizing: border-box;
outline: none;
}
body {
position: relative;
margin: 0;
padding: 0;
font-family: 'Source Sans Pro', sans-serif;
font-size: 16px;
font-smooth: auto;
font-weight: 300;
line-height: 1.75;
color: $color-1;
overflow-x: hidden;
}
.menu {
position: fixed;
top: 20px;
left: 20px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 50px;
height: 50px;
background-color: white;
border-radius: 50%;
//box-shadow: 0 0 20px rgba(black,0.2);
transition: transform 250ms ease;
cursor: pointer;
z-index: 200;
span {
position: relative;
display: block;
width: 50%;
height: 2px;
background-color: $color-1;
float: left;
transform-origin: center center;
transition: transform 250ms ease;
z-index: 200;
&:nth-of-type(1) {
transform: translateY(-5px);
}
&:nth-of-type(3) {
transform: translateY(5px);
}
}
}
#menu {
display: none;
&:checked ~ .menu {
background-color: transparent;
transform: rotate(360deg);
transition: transform 250ms ease;
span {
background-color: white;
transition: transform 250ms ease;
&:nth-of-type(1) {
transform: translateY(1px) rotate(45deg);
}
&:nth-of-type(2) {
display: none;
}
&:nth-of-type(3) {
transform: translateY(-1px) rotate(-45deg);
}
}
}
&:checked ~ .nav {
left: 0px;
transition: left $base-duration ease;
}
&:checked ~ main {
transform: translateX(250px);
transition: transform $base-duration ease;
}
}
.nav {
position: fixed;
top: 0;
left: -210px;
width: 300px;
height: 100vh;
margin: 0;
padding: 0;
background-color: $color-1;
transition: left $base-duration ease;
z-index: 0;
ul {
position: relative;
list-style-type: none;
margin: 100px 0;
padding: 0;
li {
position: relative;
display: block;
border-bottom: 5px solid rgba(white,1);
a {
position: relative;
display: block;
margin: 0;
padding: 15px 20px;
color: white;
font-size: 14px;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
&:before {
position: absolute;
content: '';
top: 0;
left: 0;
width: 0;
height: 100%;
transition: width 250ms ease;
z-index: -1;
}
&:hover {
color: #444;
&:before {
width: 100%;
height: 100%;
background-color: rgba(white,1);
transition: width 250ms ease;
}
}
}
}
}
}
.container {
width: 75%;
margin: 0 auto;
}
main {
position: relative;
display: block;
width: 100%;
padding: 0;
box-shadow: 0 0 20px rgba(black,0.5);
transform: translateX(0px);
transition: transform $base-duration ease;
z-index: 0;
header {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 300px;
background-color: whitesmoke;
// background-image: url('https://static.pexels.com/photos/110186/pexels-photo-110186.jpeg');
// background-position: center center;
// background-repeat: no-repeat;
// background-size: cover;
// &:after {
// position: absolute;
// content: '';
// top: 0;
// left: 0;
// width: 100%;
// height: 100%;
// background-color: rgba(white,0.5);
// z-index: 0;
// }
h1 {
color: #ccc;
z-index: 3;
}
}
section {
position: relative;
display: block;
margin: 0;
padding: 50px 0;
background-color: white;
z-index: 100;
p {
margin-bottom: 30px;
}
}
.img {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 300px;
background-color: $color-1;
// background-image: url('https://static.pexels.com/photos/108023/pexels-photo-108023.jpeg');
// background-position: center center;
// background-repeat: no-repeat;
// background-size: cover;
h1 {
color: rgba(white,0.2);
}
}
footer {
@include clearfix;
position: relative;
display: block;
width: 100%;
height: auto;
margin: 0;
padding: 20px 20px 20px;
background-color: $color-1;
.logo {
font-size: 28px;
color: whitesmoke;
line-height: 0;
margin-bottom: 8px;
margin-right: 4px;
@include media($lg) {
float: left;
margin-bottom: 0;
}
}
ul {
@include clearfix;
line-height: 1.5;
margin: 0 0 16px 0;
padding: 0;
@include media($lg) {
@include clearfix;
float: left;
line-height: 1.8;
margin-bottom: 0;
margin-left: 16px;
}
li {
list-style: none;
padding-right: 16px;
@include media($lg) {
display: inline;
text-align: left;
}
a {
color: rgba(white,0.7);
font-size: 14px;
font-weight: bold;
text-decoration: none;
&:focus,
&:hover {
color: rgba(white,1);
}
}
}
}
.secondary-links {
@include media($lg) {
float: right;
}
li {
a {
font-size: 12px;
font-weight: 100 !important;
}
}
.social {
margin: 1em 0 0 0;
@include media($lg) {
float: right;
margin-top: 0;
}
li {
float: left;
font-size: 1em;
line-height: 0;
margin: 0;
padding-right: 0.7em;
&:last-child {
padding-right: 0;
}
> a {
position: relative;
display: block;
width: 30px;
height: 30px;
background-color: rgba(white,0.7);
border-radius: 50%;
color: $color-1;
text-align: center;
line-height: 30px;
&:hover {
background-color: rgba(white,1);
}
}
}
}
}
}
}
Also see: Tab Triggers