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.
<html>
<head>
<title>Parallax Template - uplusion23</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-smooth-scroll/1.5.5/jquery.smooth-scroll.min.js"></script>
</head>
<body>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>
<div class="navbar">
<ul class="navbar-container">
<li><a href="#" class="left-underline nav-button brand-logo">Brand Logo</a></li>
<li class="nav-item"><a href="#section-3" class="left-underline nav-button" data-scroll>Wallet</a></li>
<li class="nav-item"><a href="#section-2" class="left-underline nav-button" data-scroll>Pictures</a></li>
<li class="nav-item active"><a href="#section-1" class="left-underline nav-button" data-scroll>Home</a></li>
</ul>
</div>
<div class="parallax p1" id="section-1">
<hgroup>
<h1>Hello.</h1>
<h2>I’m a startup.</h2>
</hgroup>
</div>
<div class="row">
<div class="col-3">
<h1>First Section Col1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam cursus maximus quam et dignissim. Praesent felis arcu, euismod et ullamcorper ut, condimentum ut ante. Vestibulum vel libero commodo, aliquam libero eu, gravida arcu. Proin scelerisque faucibus ligula quis efficitur. Donec at sollicitudin purus, suscipit tempus augue. Sed imperdiet volutpat sapien at hendrerit. Mauris egestas ex a quam tincidunt gravida. Quisque interdum tempor lacinia. Nulla eget varius purus. Integer non sollicitudin dui. Phasellus sem turpis, maximus in auctor vulputate, porta id nunc.</p>
</div>
<div class="col-3">
<h1>First Section Col2</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque imperdiet est id leo facilisis, quis egestas erat vehicula. Aenean nec facilisis leo, et tristique lorem. Aliquam porttitor, elit ac ornare lacinia, sapien augue sagittis dolor, tempor ultricies lorem arcu et ante. Nulla facilisi. Praesent facilisis lacus at blandit maximus. Ut at libero nisi. Cras eu augue tellus. Nam pretium eget nisi non viverra. Maecenas eget tincidunt nibh, vitae interdum dolor.</p>
</div>
<div class="col-3">
<h1>First Section Col3</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac nibh dolor. Cras rutrum molestie ligula posuere hendrerit. Donec luctus vitae elit in gravida. Duis in viverra nunc. Nunc et metus blandit, blandit quam in, laoreet mi. In vitae mauris sit amet tellus dictum rhoncus malesuada non arcu. Ut lacus lacus, dignissim at commodo id, dapibus sed felis. Cras in nunc id est lobortis euismod. Sed egestas nulla et augue sagittis lacinia. Quisque finibus bibendum risus, vitae accumsan ante mollis ac. Aliquam fermentum, mauris eu gravida dictum, tortor risus finibus nibh, in tincidunt velit tortor vehicula mi.</p>
</div>
</div>
<div class="parallax p2" id="section-2">
<hgroup>
<h1>Well</h1>
<h2>This is some bold info!</h2>
</hgroup>
</div>
<div class="row">
<div class="col-3">
<h1>First Section Col1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam cursus maximus quam et dignissim. Praesent felis arcu, euismod et ullamcorper ut, condimentum ut ante. Vestibulum vel libero commodo, aliquam libero eu, gravida arcu. Proin scelerisque faucibus ligula quis efficitur. Donec at sollicitudin purus, suscipit tempus augue. Sed imperdiet volutpat sapien at hendrerit. Mauris egestas ex a quam tincidunt gravida. Quisque interdum tempor lacinia. Nulla eget varius purus. Integer non sollicitudin dui. Phasellus sem turpis, maximus in auctor vulputate, porta id nunc.</p>
</div>
<div class="col-3">
<h1>First Section Col2</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque imperdiet est id leo facilisis, quis egestas erat vehicula. Aenean nec facilisis leo, et tristique lorem. Aliquam porttitor, elit ac ornare lacinia, sapien augue sagittis dolor, tempor ultricies lorem arcu et ante. Nulla facilisi. Praesent facilisis lacus at blandit maximus. Ut at libero nisi. Cras eu augue tellus. Nam pretium eget nisi non viverra. Maecenas eget tincidunt nibh, vitae interdum dolor.</p>
</div>
<div class="col-3">
<h1>First Section Col3</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac nibh dolor. Cras rutrum molestie ligula posuere hendrerit. Donec luctus vitae elit in gravida. Duis in viverra nunc. Nunc et metus blandit, blandit quam in, laoreet mi. In vitae mauris sit amet tellus dictum rhoncus malesuada non arcu. Ut lacus lacus, dignissim at commodo id, dapibus sed felis. Cras in nunc id est lobortis euismod. Sed egestas nulla et augue sagittis lacinia. Quisque finibus bibendum risus, vitae accumsan ante mollis ac. Aliquam fermentum, mauris eu gravida dictum, tortor risus finibus nibh, in tincidunt velit tortor vehicula mi.</p>
</div>
</div>
<div class="parallax p3">
<hgroup>
<h1>Well</h1>
<h2>This is some bold info!</h2>
</hgroup>
</div>
<footer>
<div class="row" id="section-3">
<div class="col-3">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum interdum tortor ac dui malesuada, id molestie elit aliquam. Fusce laoreet nisl id tellus molestie mattis. Fusce vitae ante quis augue imperdiet rutrum a vitae purus. Etiam tincidunt enim id turpis varius, in condimentum elit.</p>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© 2011-2015 uplusion23, All rights reserved.
</div>
</div>
</footer>
</body>
</html>
body {
background-color: #ECECEC;
color: #444444;
padding: 0;
margin: 0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-x: hidden;
font-family: 'Roboto';
}
.left-underline {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
overflow: hidden;
}
.left-underline:before {
content: "";
position: absolute;
z-index: -1;
left: 0;
right: 100%;
bottom: 0;
background: #ECECEC;
height: 4px;
-webkit-transition-property: right;
transition-property: right;
-webkit-transition-duration: 0.15s;
transition-duration: 0.15s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.left-underline:hover:before, .left-underline:focus:before, .left-underline:active:before {
right: 0;
}
div.navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: #ee6e73;
-webkit-box-shadow: 0px 2px 6px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 2px 6px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 2px 6px 0px rgba(50, 50, 50, 0.75);
z-index: 9999999;
}
div.navbar > ul.navbar-container {
list-style-type: none;
margin: 0;
padding-left: 1em;
padding-right: 1em;
overflow: hidden;
}
div.navbar > ul > li.nav-item {
float: right;
background-color: rgba(0, 0, 0, 0.1);
transition: all 0.5s ease;
}
div.navbar > ul > li.active {
background-color: rgba(0, 0, 0, 0.18);
}
div.navbar > ul > li:hover {
background-color: rgba(0, 0, 0, 0.2);
}
a.nav-button {
font-family: 'Roboto';
text-decoration: none;
line-height: 60px;
padding-left: 20px;
padding-right: 20px;
color: rgba(228, 241, 254, 1);
transition: all 0.5s ease;
}
a.nav-button:hover {
text-decoration: none;
}
li.active > a.nav-button {
cursor: default;
}
.brand-logo {
float: left;
cursor: default;
}
.parallax {
height: 70vh;
overflow: hidden;
margin: 0;
padding: 0;
}
.parallax.p1 {
background: url(http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-70374.jpg) no-repeat fixed 50% 0;
background-size: cover;
color: #fff;
}
.parallax.p2 {
background: url(http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-126549.jpg) no-repeat fixed 50% 0;
background-size: cover;
color: #fff;
}
.parallax.p3 {
background: url(http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-95766.jpg) no-repeat fixed 70% 0;
background-size: cover;
color: #fff;
}
.parallax-text {
width: 24em;
position: fixed;
top: 20%;
left: 50%;
border: .5em solid #fff;
margin-left: -10%;
padding: 2em 0;
text-align: center;
z-index: 999;
}
.parallax > div.blur-image {
position: relative;
width: 100%;
height: 100%;
}
hgroup{
display: inline-block;
text-align: center;
position: relative;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
color: #fff;
border: 5px solid #fff;
padding: .5em 3em;
background-color: rgba(0,0,0,.2);
z-index: 2;
}
.row {
width: 80%;
padding-left: 10%;
padding-right: 10%;
padding-top: 15px;
padding-bottom: 15px;
min-height: 150px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.row > .col-3 {
width: 30%;
height: 100%;
box-sizing: border-box;
float: left;
padding-left: 5px;
padding-right: 5px;
}
footer {
width: 100%;
padding-top: 20px;
display: block;
background-color: #ee6e73;
}
.footer-copyright {
font-weight: 300;
overflow: hidden;
height: 50px;
line-height: 50px;
color: rgba(255, 255, 255, 0.8);
background-color: rgba(51, 51, 51, 0.08);
}
.container {
width: 85%;
padding: 0 1.5rem;
margin: 0 auto;
max-width: 1280px;
}
footer p {
border-left: 3px solid #ffcdd2;
padding-left: 15px;
text-indent: 20px;
color: #ececec;
}
/* Blank lines for ease and view */
/* */
function EasyPeasyParallax() {
scrollPos = $(this).scrollTop();
$('.p1').css({
'background-position' : '50% ' + (-scrollPos/4)+"px"
});
$('.p2').css({
'background-position' : '50% ' + (-scrollPos/8)+"px"
});
$('.p3').css({
'background-position' : '70% ' + (-scrollPos/16)+"px"
});
$('.parallax-text').css({
'margin-top': (scrollPos/2)+"px",
'opacity': 1-(scrollPos/230)
});
}
$(document).ready(function(){
$(window).scroll(function() {
EasyPeasyParallax();
});
});
Also see: Tab Triggers