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="navContainer">
<div class="insideNavContainer">
<div class="siteBranding">
<p>Matt Haynes</p>
</div>
<nav id="mainNav">
<ul>
<li><a href="" class="aboutMe">About Me</a></li>
<li><a href="" class="myWork">My Projects</a></li>
<li><a href="" class="contact">Contact</a></li>
</ul>
<button class="c-hamburger c-hamburger--htx">
<span>toggle menu</span>
</button>
</nav>
</div>
</div>
</nav>
<div id="page">
<div class="headerWrap">
<section class="container header">
<h1>Matt Haynes</h1>
<h4>A passionate web developer and designer; helping fill the internet with beautiful websites one page at a time using HTML, CSS, Javascript/jQuery, and PHP</h4>
<span class="downArrow"><i class="fa fa-angle-down"></i></span>
</section>
</div>
<div id="content">
<section id="aboutMe" class="content aboutMe">
<h2>A little something about me</h2>
<p>My name is Matt. I'm an extremely passionate, and enthusiastic self taught front end developer, and server administrator, originally from Sheffield. I'm working on becoming an expert in HTML, CSS, Javascript, and soon to be delving deeper into PHP. I like to think I have an eye for web design but development is my primary passion. My goal is to become a software engineer, contributing toward something that will help society progress. I love a bit of work place banter & a good Yorkshire brew... or a pint, whichever's going!</p>
</section>
<section class="content quote">
<p><i class="fa fa-quote-left"></i>Make every detail perfect and limit the number of details to perfect.<i class="fa fa-quote-right"></i></p>
</section>
<section id="myWork" class="content myWork">
<h2>Projects</h2>
<h3>I've selected a few projects I've had the pleasure of working on.</h3>
<div class="myWorkWrap">
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 1</span></a>
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 2</span></a>
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 3</span></a>
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 4</span></a>
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 5</span></a>
<a class="" alt="project" title="project" target="_blank" href="#0"><img src="http://matthaynes.uk/external_pull/placeholderImageProj.png" /><span class="hoverItem"></span><span class="hoverTitle">Title 6</span></a>
</div>
</section>
<section id="contact" class="content contact">
<h2>Contact</h2>
<h3>Feel free to get in touch any time! I'd love to hear from you.</h3>
<div class="contactWrap">
<form method="" action="" id="contactForm">
<input type="text" placeholder="Name" name="name" class="name" required />
<input type="email" placeholder="Email" name="email" class="email" required />
<input type="text" placeholder="Subject" name="subject" class="subject" required />
<textarea placeholder="Message" name="message" class="message" required /></textarea>
<input type="submit" name="submit" value="Submit" />
</form>
</div>
</section>
<footer>
<nav id="footerNav">
<ul>
<li><a href="https://www.facebook.com/peccavi91" target="_blank" alt="facebook" title="facebook"><i class="fa fa-facebook"></i></a></li>
<li><a href="https://codepen.io/Mattgh9152/" target="_blank" alt="codepen" title="codepen"><i class="fa fa-codepen"></i></a></li>
<li><a href="https://www.freecodecamp.com/mattgh91" target="_blank" alt="freeCodeCamp" title="freeCodeCamp"><i class="fa fa-free-code-camp"></i></a></li>
<li class="clear"></li>
</ul>
</nav>
</footer>
</div>
<div class="scrollUp"><i class="fa fa-angle-up"></i></div>
</div>
@import url('https://fonts.googleapis.com/css?family=Lato:300,400');
* {
line-height:1.5;
font-weight:300;
}
body,
html {
margin:0;
padding:0;
font-family:Lato;
width:100%;
height:100%;
overflow-x:hidden;
}
.clear {
clear:both;
float:none;
}
body {
background:#004a56;
color:#ffffff;
background:linear-gradient(
rgba(0, 0, 0, 0.45),
rgba(0, 0, 0, 0.15)
), url('http://matthaynes.uk/external_pull/portfolio-background.jpg') no-repeat center center fixed;
background-size: cover;
width: 100%;
height: 100vh;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
display: table;
}
.navContainer {
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
z-index:999;
}
.navContainer * {
font-weight:400;
}
.container {
max-width:1024px;
width:90%;
margin:0 auto;
text-align:center;
}
.headerWrap {
display:table;
height:100vh;
width:100%;
}
.header {
display:table-cell;
width:100%;
vertical-align:middle;
}
h1 {
font-size:42px;
margin:20px 0;
font-weight:400;
}
h4 {
max-width:500px;
margin:0 auto;
width:90%;
font-weight:400;
}
.downArrow {
padding-top:20px;
display: inline-block;
font-size:36px;
cursor:pointer;
}
#content {
background:#ffffff;
color:#1a1a1a;
padding:50px 0;
}
#content h2 {
text-align:center;
font-size:36px;
padding:0 20px;
margin-top:0;
}
#content h3 {
text-align:center;
padding:0 20px;
}
section {
margin:50px 0;
}
section.aboutMe {
margin-top:0;
}
section.myWork {
margin-bottom:0;
}
.navContainer a {
color:#ffffff;
text-decoration:none;
}
.navContainer {
position:fixed;
width:100%;
background-color:rgba(255,255,255,0);
border-bottom: 1px solid transparent;
}
.navContainer .insideNavContainer {
padding:0 20px;
}
.navContainer .siteBranding {
float:left;
font-size:28px;
}
.navContainer #mainNav {
float:right;
}
.navContainer #mainNav ul {
margin:0;
padding:0;
}
.navContainer #mainNav ul li {
float:left;
list-style:none;
margin:38px 0 0 40px;
font-size:18px;
line-height:28px;
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
}
.navContainer #mainNav ul li:hover {
-ms-transform: scale(1.1); /* IE 9 */
-webkit-transform: scale(1.1); /* Safari */
transform: scale(1.1);
}
.navContainer.scrolled {
background-color:rgba(255,255,255,1);
border-bottom: 1px solid #e7e7e7;
box-shadow: 0 2px 5px rgba(0,0,0,.26);
}
.navContainer.scrolled * {
color:#0aa7d8;
}
.quote {
background:linear-gradient(
rgba(0, 0, 0, 0.15),
rgba(0, 0, 0, 0.45)
), url('http://matthaynes.uk/external_pull/portfolio-backgroundLower.jpg') no-repeat center center fixed;
background-size: cover; width: 100%; display: table; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-attachment:fixed;
}
.quote .fa-quote-left,
.quote .fa-quote-right {
font-size:24px;
position:relative;
}
.quote .fa-quote-left {
top:-15px;
left:-10px;
}
.quote .fa-quote-right {
top:-15px;
right:-10px;
}
.aboutMe p {
text-align:center;
width:80%;
margin:0 auto 80px;
}
.quote p {
display:block;
max-width:1024px;
margin:0 auto;
padding:150px 20px;
color:#ffffff;
text-align:center;
font-size:42px;
}
.contactWrap,
.myWorkWrap {
max-width:1024px;
margin:0 auto;
padding:0 20px;
}
.myWorkWrap a {
display: inline-block;
width: 31%;
margin: 1%;
text-align: center;
height: 178px;
background: #39a7d8;
overflow:hidden;
position:relative;
}
.myWorkWrap a img {
width:100%;
height:100%;
}
.myWorkWrap a span.hoverItem {
display: block;
width: 200%;
height: 400%;
background: rgba(10, 167, 216, 0.7);
transition: all 0.8s;
transform: rotate(-25deg);
top: -800px;
position: relative;
left: 600px;
}
.myWorkWrap a span.hoverTitle {
opacity:0;
position: absolute;
top: calc(50% - 11px);
transition: all 0.8s;
left: 0;
width: 100%;
color: #ffffff;
}
.myWorkWrap a:hover > span.hoverTitle {
opacity:1;
}
.myWorkWrap a:hover > span.hoverItem {
top:-350px;
left:-100px;
}
.contactWrap form {
width:100%;
max-width:750px;
margin:0 auto;
}
.contactWrap form * {
font-family: lato;
font-weight: 400;
font-size:14px;
padding:5px;
}
.contactWrap form input.name,
.contactWrap form input.email {
width:47%;
margin-bottom:15px;
}
.contactWrap form input.email {
float:right;
}
.contactWrap form input.subject {
width:calc(100% - 14px);
margin-bottom:15px;
}
.contactWrap form textarea {
width:calc(100% - 12px);
margin-bottom:10px;
resize:vertical;
min-height:150px;
}
.contactWrap form input[type=submit] {
width:100%;
background:#0aa7d8;
color:#ffffff;
border:none;
box-shadow:none;
padding:7.5px 0;
cursor:pointer;
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
}
.contactWrap form input[type=submit]:hover {
background:#0c5b73;
}
footer ul {
margin: 0;
padding: 0 20px;
}
footer ul li {
list-style: none;
float: left;
margin: 0 25px 0 0;
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
}
footer ul li a {
color: #0aa7d8;
}
footer ul li:hover {
-ms-transform: scale(1.3); /* IE 9 */
-webkit-transform: scale(1.3); /* Safari */
transform: scale(1.3);
}
.c-hamburger {
display: block;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
width: 50px;
height: 50px;
font-size: 0;
text-indent: -9999px;
appearance: none;
box-shadow: none;
border-radius: none;
border: none;
cursor: pointer;
transition: background 0.3s;
display:none;
}
.c-hamburger:focus {
outline: none;
}
.c-hamburger span {
display: block;
position: absolute;
top: 24px;
left: 10px;
right: 10px;
height: 4px;
background: #0aa7d8;
}
.navContainer.scrolled .c-hamburger span {
background:#ffffff;
}
.c-hamburger span::before,
.c-hamburger span::after {
position: absolute;
display: block;
left: 0;
width: 100%;
height: 4px;
background-color: #0aa7d8;
content: "";
}
.navContainer.scrolled .c-hamburger span::before,
.navContainer.scrolled .c-hamburger span::after {
background-color:#ffffff;
}
.c-hamburger span::before {
top: -12px;
}
.c-hamburger span::after {
bottom: -12px;
}
.c-hamburger--htx {
background-color: #ffffff;
top:25px;
}
.navContainer.scrolled .c-hamburger--htx {
background-color: #0aa7d8;
}
.c-hamburger--htx span {
/*transition: background 0s 0.3s;*/
}
.c-hamburger--htx span::before,
.c-hamburger--htx span::after {
transition: 0.3s;
-duration: 0.3s, 0.3s;
transition-delay: 0.3s, 0s;
}
.c-hamburger--htx span::before {
transition-property: top, transform;
}
.c-hamburger--htx span::after {
transition-property: bottom, transform;
}
/* active state, i.e. menu open */
.navContainer.scrolled .c-hamburger--htx.is-active {
background-color: #0c5b73;
}
.navContainer .c-hamburger--htx.is-active span {
background: none;
}
.c-hamburger--htx.is-active span::before {
top: 0;
transform: rotate(45deg);
}
.c-hamburger--htx.is-active span::after {
bottom: 0;
transform: rotate(-45deg);
}
.c-hamburger--htx.is-active span::before,
.c-hamburger--htx.is-active span::after {
transition-delay: 0s, 0.3s;
}
.scrollUp {
position:fixed;
right:20px;
bottom:40px;
display:block;
font-size:36px;
background:rgba(0,0,0,0.7);
padding:0 15px 5px;
cursor:pointer;
display:none;
}
@media screen and (max-width: 768px) {
.myWorkWrap a {
width:47.5%;
}
body,
.quote {
background-attachment:scroll;
}
}
@media screen and (min-width: 767px) {
.navContainer #mainNav ul {
display:block !important;
}
}
@media screen and (max-width: 767px) {
.navContainer #mainNav ul {
display:none;
position: absolute;
width: 100%;
left: 0;
top: 100px;
background: #ffffff;
border-bottom: 1px solid #e7e7e7;
}
.navContainer #mainNav ul li {
float: none;
width: 100%;
text-align: center;
padding: 20px 0;
margin:0;
}
.c-hamburger {
display:block;
}
.contactWrap form input.name,
.contactWrap form input.email {
width:calc(100% - 14px);
float:none;
}
}
@media screen and (max-width:520px) {
.myWorkWrap a {
width:100%;
}
}
$(".downArrow").on("click", function(){
$('html, body').animate({
scrollTop: $("#aboutMe").offset().top-125
}, 1500);
});
$(window).on("load resize scroll",function(e){
if($(this).scrollTop() > 1 || $('.c-hamburger').hasClass('is-active')) {
$('.navContainer').addClass('scrolled');
}
else {
$('.navContainer').removeClass('scrolled');
}
if($(this).width() > 767) {
$('.c-hamburger').removeClass('is-active');
$('.navContainer #mainNav ul').slideUp('fast');
}
if($(this).scrollTop() > 100) {
$('.scrollUp').fadeIn();
}
else {
$('.scrollUp').fadeOut();
}
});
$('.scrollUp').on("click", function(){
$('html, body').animate({
scrollTop: $(".headerWrap").offset().top
}, 1500);
});
$('.c-hamburger').on("click", function(){
$('.navContainer #mainNav ul').slideToggle();
if ( $( '.navContainer' ).hasClass( "scrolled" ) && ($(window).scrollTop() > 1)) {
//Do nothing
}
else {
$('.navContainer').toggleClass('scrolled');
}
});
(function() {
"use strict";
var toggles = document.querySelectorAll(".c-hamburger");
for (var i = toggles.length - 1; i >= 0; i--) {
var toggle = toggles[i];
toggleHandler(toggle);
};
function toggleHandler(toggle) {
toggle.addEventListener( "click", function(e) {
e.preventDefault();
(this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
});
}
})();
$('.navContainer #mainNav ul li a').on("click", function(event){
var scrollToThis = $(this).attr("class");
//alert(scrollToThis);
event.preventDefault();
$('html, body').animate({
scrollTop: $("#"+scrollToThis).offset().top-125
}, 1500);
$('.c-hamburger').removeClass('is-active');
$('.navContainer #mainNav ul').slideUp();
});
Also see: Tab Triggers