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.
<nav>
<div class="menu">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
<div class="circle hidenav">
<ul>
<li> <a href="#">test1</a>
</li>
<li> <a href="#">test2</a>
</li>
<li> <a href="#">test3</a>
</li>
<li> <a href="#">test1</a>
</li>
<li> <a href="#">test2</a>
</li>
<li> <a href="#">test3</a>
</li>
<li> <a href="#">test1</a>
</li>
<li> <a href="#">test3</a>
</li>
<li> <a href="#">test3</a>
</li>
</ul>
</div>
</nav>
<div class="intro">
<p>A title goes here!</p>
<div class="scrolldown"></div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam elementum libero eu eleifend congue. Aenean laoreet pharetra tortor, quis egestas dolor bibendum non. Duis posuere odio quis turpis faucibus, eu viverra odio ultricies. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla facilisis in nisl et placerat. Donec interdum odio libero, eu dictum urna condimentum non. Quisque justo libero, bibendum suscipit tincidunt ut, accumsan eget diam. Duis condimentum nulla a felis accumsan, vitae consectetur risus egestas. Maecenas suscipit tortor vel libero molestie, vitae convallis massa condimentum.</p>
<p>Sed metus urna, cursus nec euismod bibendum, pharetra sit amet mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas accumsan tellus sed sapien imperdiet, vel convallis ligula mollis. Nullam sagittis dolor et molestie aliquet. Nulla volutpat pulvinar lacus, non accumsan risus gravida eget. Ut suscipit, orci non porta pretium, lectus sem tincidunt erat, vitae commodo nulla est vitae orci. Aenean ullamcorper ornare lorem, at dapibus nisl iaculis eu. Aenean ut venenatis est. In sagittis libero quis nulla interdum euismod. Integer tempor blandit velit id laoreet. In quis fringilla tortor.</p>
<p>Suspendisse tortor risus, porttitor nec est vitae, facilisis vestibulum lorem. Aenean elit nisi, convallis et ullamcorper accumsan, luctus id velit. Aliquam erat volutpat. Pellentesque vulputate, augue eget facilisis porttitor, risus dui auctor eros, non rhoncus lorem risus eget lectus. Phasellus suscipit nibh nec sapien elementum, sit amet hendrerit tortor ornare. Quisque blandit eu metus in pharetra. Curabitur porttitor velit ut vestibulum iaculis. Nunc pharetra ante sit amet urna porttitor, ut venenatis diam fringilla. Nulla facilisi.
<p>Maecenas ut vulputate nulla, vel sodales lectus. Fusce vestibulum, sapien et ultrices aliquet, urna nibh tristique erat, nec sodales arcu urna eget nulla. Quisque convallis quam sed risus aliquam, id consequat augue facilisis. Praesent ultrices faucibus dui eget laoreet. In pharetra sit amet erat ac aliquam. Aliquam tincidunt leo in laoreet ornare. Quisque ac ante gravida, vehicula velit vitae, pretium felis. Sed mattis lorem non arcu ultricies, sit amet venenatis diam pulvinar. Fusce euismod egestas metus sed bibendum. Etiam ut tincidunt enim, commodo ornare lectus. Etiam magna elit, faucibus sit amet lobortis id, ultrices a ipsum. Praesent sit amet porttitor orci. Sed ornare laoreet nibh, rutrum consectetur tellus ornare a. Suspendisse porttitor magna sed nisi mollis, sed elementum lacus tincidunt.</p>
<p>Mauris at magna ipsum. Fusce ornare augue eu lectus pharetra, et fringilla arcu ultricies. Sed eu sapien tellus. Mauris faucibus dui sit amet eros sagittis, non accumsan erat tincidunt. Integer a libero consequat enim tempor scelerisque. Maecenas ac est ipsum. Pellentesque sed pulvinar magna.</p>
</div>
html, body {
height: 99%;
min-height: 99%;
}
body {
padding: 0;
margin: 0;
background: url(http://upload.wikimedia.org/wikipedia/commons/c/cd/Orion_Rainbow.jpg) no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.intro {
text-align: center;
height: 99%;
min-height: 99%;
position: relative;
}
.intro p {
color: #fefefe;
font-weight: bold;
font-family:'Arial Narrow', sans-serif;
text-transform: uppercase;
text-shadow: 0 2px 5px rgba(0, 0, 0, .6)
}
.scrolldown {
border-style: dashed;
border-color: transparent;
border-width: 0.53em;
display: -moz-inline-box;
display: inline-block;
/* Use font-size to control the size of the arrow. */
font-size: 20px;
height: 0;
line-height: 0;
position: absolute;
bottom: 20px;
left: 50%;
width: 0;
border-top-width: 1em;
border-top-style: solid;
border-top-color: #eee;
}
.content {
padding: 20px;
background: #eee;
}
p {
padding-bottom: 20px;
font-size: 20px;
line-height: 1.5;
}
nav {
position: absolute;
top: 0;
right: 0;
z-index: 9999;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
nav .menu {
position: fixed;
padding: 14px 0;
/*height and padding(top/bottom) add up to 60px(same as width)*/
height: 32px;
width: 60px;
top: 20px;
right: 20px;
border-radius: 50%;
z-index: 999;
cursor: pointer;
background: rgb(255, 255, 255);
background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(229, 229, 229, 1)));
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%);
background: -o-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%);
background: -ms-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%);
background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e5e5e5', GradientType=0);
box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, .25);
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
-ms-transition: all 300ms ease;
-o-transition: all 300ms ease;
transition: all 300ms ease;
}
nav .menu:hover {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
nav .menu:active {
-moz-transform: scale(.9);
-webkit-transform: scale(.9);
-o-transform: scale(.9);
-ms-transform: scale(.9);
transform: scale(.9);
}
nav .menu .bar {
height: 4px;
width: 30px;
border-radius: 2px;
margin: 5px auto;
display:block;
z-index: 9999;
background: #aaa;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
-ms-transition: all 300ms ease;
-o-transition: all 300ms ease;
transition: all 300ms ease;
}
nav .menu:hover > .bar {
background: rgba(100, 160, 255, 1);
}
nav .circle {
-moz-opacity: 1;
opacity: 1;
font-size: 20px;
color: #eee;
position: fixed;
top: -170px;
right: -170px;
display: block;
height: 400px;
width: 400px;
background: rgba(100, 100, 100, .9);
box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, .5), inset 0 0 200px rgba(0, 0, 0, .5);
padding: 20px;
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
-ms-transition: all 300ms ease;
-o-transition: all 300ms ease;
transition: all 300ms ease;
border-radius: 50%;
overflow:hidden !important;
}
nav .circle li {
list-style:none !important;
background: rgba(0, 0, 0, 0);
}
nav .circle li a {
-moz-opacity: 1;
opacity: 1;
position: absolute;
top: -80px;
left: 220px;
display:block;
width: 500px;
height: 300px;
background: rgba(50, 50, 50, .5);
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .1);
-webkit-transform-origin: 0% 100%;
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
-ms-transition: all 300ms ease;
-o-transition: all 300ms ease;
transition: all 300ms ease;
}
nav .circle li a:hover {
background: rgba(255, 120, 20, 1) !important;
}
nav .circle li:first-child a {
-webkit-transform: rotate(-165deg) skewX(-50deg);
}
nav .circle li:nth-child(2) a {
-webkit-transform: rotate(-205deg) skewX(-50deg);
}
nav .circle li:nth-child(3) a {
-webkit-transform: rotate(-245deg) skewX(-50deg);
}
nav .circle li:nth-child(4) a {
-webkit-transform: rotate(-285deg) skewX(-50deg);
pointer-events: none;
}
nav .circle li:nth-child(5) a {
-webkit-transform: rotate(-325deg) skewX(-50deg);
pointer-events: none;
}
nav .circle li:nth-child(6) a {
-webkit-transform: rotate(-45deg) skewX(-50deg);
pointer-events: none;
}
nav .circle li:nth-child(7) a {
-webkit-transform: rotate(-5deg) skewX(-50deg);
pointer-events: none;
}
nav .circle li:nth-child(8) a {
-webkit-transform: rotate(275deg) skewX(-50deg);
pointer-events: none;
}
nav .circle li:last-child a {
-webkit-transform: rotate(235deg) skewX(-50deg);
pointer-events: none;
}
nav .hidenav {
-moz-opacity: .5;
opacity: .5;
-moz-transform: scale(0.1) rotate(-60deg);
-webkit-transform: scale(0.1) rotate(-60deg);
-o-transform: scale(0.1) rotate(-60deg);
-ms-transform: scale(0.1) rotate(-60deg);
transform: scale(0.1) rotate(-60deg);
}
$("nav .menu").click(function () {
$('nav .circle a').css("background", "rgba(50,50,50,.5)");
$('nav .circle').stop().toggleClass('hidenav');
});
$("a").click(function () {
$(this).css("background", "rgba(255,200,0,1)");
setTimeout(function () {
$('nav .circle').stop().addClass('hidenav');
}, 1000);
});
Also see: Tab Triggers