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.
<!-- Floating header -->
<div id="nav">
<header class="header container">
<div class="logo"></div>
<!-- Menu on tablets and larger screens -->
<nav class="top-nav">
<ul>
<li><a class="under-line" href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contacts">Get in touch</a></li>
</ul>
</nav>
<!-- Menu on mobile screens -->
<div class="mob-nav">
<span class="fa fa-bars"></span>
</div>
<nav>
<ul class="dropDN-menu">
<li><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contacts">Get in touch</a></li>
</ul>
</nav>
</header>
</div>
<!-- Main -->
<main role="main">
<!-- Banner -->
<section class="banner container">
<div class="photo-banner">
<img src="https://res.cloudinary.com/belodpav/image/upload/v1475403892/freecodecamp/second_project(Profile%20page)/images/img-01.jpg" alt="Pavel Belodurin">
</div>
<div class="descr-banner">
<h1><Coder<span class="slash">/</span>></h1>
<p>Front-End developer who is focused<br>on writting clean, good and<br>
efficient code. Love HTML5, CSS3,<br>and JavaScript.</p>
<a href="#portfolio" class="btn">View Portfolio</a>
</div>
</section>
<!-- About -->
<div class="first-style-sec">
<section id="about" class="about space-section container">
<h2><About<span class="slash">/</span>></h2>
<p>Hello! My name is Pavel.I’m a student and Front-End developer from Russia.
I like researching different problems about science, IT,
Psychology, etc. I really like web development.<br>I am learning Front-End with Free Code Camp community.<br>By day, I study science at the university.<br>By night, I explore different problems.</p>
</section>
</div>
<!-- Portfolio -->
<section id="portfolio" class="portfolio space-section container">
<h2><Portfolio<span class="slash">/</span>></h2>
<!-- Tiles box for tablets and larger sreens -->
<div class="tiles-box">
<div class="item col-2-3">
<a href="https://codepen.io/belodpav/full/yazvrg/" target="_blank">
<img class="color" src="https://res.cloudinary.com/belodpav/image/upload/v1475504106/freecodecamp/second_project(Profile%20page)/images-2/img-02.jpg" alt="project1">
<img class="color-bw" src="https://res.cloudinary.com/belodpav/image/upload/v1475504106/freecodecamp/second_project(Profile%20page)/images-2/img-02-bw.jpg" alt="project1">
<div class="descr">
<h3>Portfolio page</h3>
</div>
</a>
</div><!--
--><div class="item col-1-3">
<a href="https://codepen.io/belodpav/full/mArpwG/" target="_blank">
<img class="color" src="https://res.cloudinary.com/belodpav/image/upload/v1475502197/freecodecamp/second_project(Profile%20page)/images-2/img-03.jpg" alt="project2">
<img class="color-bw" src="https://res.cloudinary.com/belodpav/image/upload/v1475403892/freecodecamp/second_project(Profile%20page)/images-2/img-03-bw.jpg" alt="project2">
<div class="descr">
<h3>Hong Knog card</h3>
</div>
</a>
</div><!--
--><div class="item col-1-3">
<a href="https://codepen.io/belodpav/full/vXXabO/" target="_blank">
<img class="color" src="https://res.cloudinary.com/belodpav/image/upload/v1475403892/freecodecamp/second_project(Profile%20page)/images-2/img-05.jpg" alt="project3">
<img class="color-bw" src="https://res.cloudinary.com/belodpav/image/upload/v1475403892/freecodecamp/second_project(Profile%20page)/images-2/img-05-bw.jpg" alt="project3">
<div class="descr">
<h3>Boat's card</h3>
</div>
</a>
</div><!--
--><div class="item col-1-3">
<a href="https://codepen.io/belodpav/full/zKwKEW/" target="_blank">
<img class="color" src="https://res.cloudinary.com/belodpav/image/upload/v1475502737/freecodecamp/second_project(Profile%20page)/images-2/img-04.jpg" alt="project4">
<img class="color-bw" src="https://res.cloudinary.com/belodpav/image/upload/v1475403892/freecodecamp/second_project(Profile%20page)/images-2/img-04-bw.jpg" alt="project4">
<div class="descr">
<h3>Tribute page</h3>
</div>
</a>
</div><!--
--><div class="item col-1-3">
<a href="https://codepen.io/belodpav/full/bZXNGY/" target="_blank">
<img class="color" src="https://res.cloudinary.com/belodpav/image/upload/v1475403893/freecodecamp/second_project(Profile%20page)/images-2/img-06.jpg" alt="project5">
<img class="color-bw" src="https://res.cloudinary.com/belodpav/image/upload/v1475403891/freecodecamp/second_project(Profile%20page)/images-2/img-06-bw.jpg" alt="project5">
<div class="descr">
<h3>Sign up form</h3>
</div>
</a>
</div>
</div>
<!-- Projects list for mobile screens -->
<div class="mob-list-projects">
<ul>
<li class="list-color-1"><a href="https://codepen.io/belodpav/full/yazvrg/" target="_blank"><h3>Portfolio page</h3></a></li>
<li class="list-color-2"><a href="https://codepen.io/belodpav/full/zKwKEW/" target="_blank"><h3>Tribute page</h3></a></li>
<li class="list-color-3"><a href="https://codepen.io/belodpav/full/mArpwG/" target="_blank"><h3>Hong Kong card</h3></a></li>
<li class="list-color-4"><a href="https://codepen.io/belodpav/full/bZXNGY/" target="_blank"><h3>Sign Up form</h3></a></li>
</ul>
</div>
<a href="">View more</a>
</section>
<!-- Get in touhc -->
<div class="first-style-sec">
<section id="contacts" class="contacts space-section container">
<h2><Get in touch<span class="slash">/</span>></h2>
<form class="" action="#" method="post">
<fieldset>
<input type="text" name="user-name" placeholder="Name"><!--
--><input type="email" name="user-email" placeholder="Email">
<textarea></textarea>
</fieldset>
<button class="btn">Send</button>
</form><!--
--><div class="social-col">
<p>Do you have questions?<br>May be suggestions?<br>Just write me.<br>I will reply you.</p>
<p><b><span class="slash">Follow</span> me in social media</b></p>
<ul>
<div class="br-icons"><li><a href="https://twitter.com/belodpav" target="_blank"><span class="icons fa fa-twitter"></span></a></li>
<li><a href="https://www.facebook.com/belod.pav" target="_blank"><span class="icons fa fa-facebook"></span></a></li>
<li><a href="https://codepen.io/belodpav/" target="_blank"><span class="icons fa fa-codepen"></span></a></li><br class="br-icons"></div>
<li><a href="https://vk.com/belodpav" target="_blank"><span class="icons fa fa-vk"></span></a></li>
<li><a href="" target="_blank"><span class="icons fa fa-google"></span></a></li>
<li><a href="https://github.com/belodpav" target="_blank"><span class="icons fa fa-git"></span></a></li>
</ul>
</div>
</section>
</div>
</main>
<!-- Footer -->
<footer>
<small>Designed by <a href="https://twitter.com/belodpav" target="_blank">Pavel Belodurin</a></small>
</footer>
/* Reset */
/* https://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Box model */
*,
*:after,
*:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* Grids */
@media(min-width: 320px) {
.container {
min-width: 320px;
padding: 0 15px;
margin: 0 auto;
}
}
@media(min-width: 768px) {
.container {
max-width: 750px;
}
}
@media(min-width: 1200px) {
.container {
max-width: 1170px;
}
}
/* Basic */
body {
font: 400 16px/26px "Roboto", sans-serif;
color: #333;
letter-spacing: .06em;
text-align: center;
padding-top: 60px;
}
h1, h2, h3 {
font-weight: 900;
color: #000;
}
h1 {
font-size: 44px;
margin-bottom: 30px;
}
h2 {
font-size: 24px;
margin-bottom: 40px;
}
h3 {
font-size: 18px;
}
a {
color: inherit;
text-decoration: underline;
}
p {
margin-bottom: 30px;
}
b {
font-weight: 900;
}
@media(min-width: 320px) {
.space-section {
padding-top: 60px;
padding-bottom: 60px;
}
}
@media(min-width: 768px) {
.space-section {
padding-top: 80px;
padding-bottom: 80px;
}
}
.first-style-sec {
background-color: #f4f4f4;
}
img {
width: 100%;
}
/* header */
.header {
height: 60px;
line-height: 60px;
text-align: left;
position: relative;
}
#nav {
margin-top: -60px;
display: block;
width: 100%;
position: fixed;
z-index: 100000;
background: #fff;
}
.head-shadow {
box-shadow: 0 2px 3px rgba(0,0,0,.15);
}
.logo, .top-nav {
display: inline-block;
vertical-align: middle;
}
.logo {
content: "";
width: 42px;
height: 42px;
line-height: 60px;
background-image: url("https://res.cloudinary.com/belodpav/image/upload/v1475403891/freecodecamp/second_project(Profile%20page)/images/logo.png");
background-size: cover;
}
.top-nav {
position: absolute;
right: 15px;
}
.top-nav li {
display: inline-block;
text-decoration: none;
color: #000;
padding-left: 20px;
font-weight: 900;
line-height: 60px;
}
.top-nav a {
text-decoration: none;
}
.dropDN-menu {
display: block;
width: 100%;
position: absolute;
z-index: 10000;
top: 60px;
left: 0;
padding: 30px 15px;
text-align: center;
background-color: #fff;
}
.dropDN-menu a {
text-decoration: none;
font-weight: 900;
}
@media(min-width: 320px) {
.top-nav {
display: none;
}
.mob-nav {
display: inline-block;
vertical-align: middle;
position: absolute;
right: 15px;
}
.mob-nav span {
font-size: 30px;
line-height: 60px;
color: #555;
cursor: pointer;
}
.dropDN-menu {
display: none;
}
}
@media(min-width: 768px) {
.top-nav {
display: inline-block;
}
.mob-nav, .dropDN-menu {
display: none;
}
}
/* Banner Section */
.banner {
text-align: left;
}
@media(min-width: 320px) {
.photo-banner {
display: none;
}
.descr-banner {
display: block;
text-align: center;
padding: 50px 0 60px 0;
}
}
@media(min-width: 768px) {
.photo-banner, .descr-banner {
display: inline-block;
vertical-align: top;
}
.photo-banner {
width: 50%;
padding-top: 64px;
margin-left: 0;
line-height: 0;
}
.descr-banner {
text-align: left;
padding-left: 60px;
padding-top: 45px;
}
}
@media(min-width: 1200px) {
.photo-banner {
margin-left: 100px;
}
.descr-banner {
padding-left: 90px;
padding-top: 135px;
}
}
/* About Section */
@media(min-width: 768px) {
.about p {
padding: 0 100px;
}
}
@media(min-width: 1200px) {
.about p {
padding: 0 300px;
}
}
/* Portfolio Section */
.mob-list-projects {
width: 100%;
text-align: center;
margin-bottom: 30px;
}
.mob-list-projects a {
display: block;
text-decoration: none;
}
.mob-list-projects h3 {
padding: 40px 0;
font-size: 22px;
}
.list-color-1 {
background-color: #fae3e9;
}
.list-color-2 {
background-color: #bcd9d4;
}
.list-color-3 {
background-color: #f4eac6;
}
.list-color-4 {
background-color: #f6d5c6;
}
.col-1-3, .col-2-3 {
display: inline-block;
position: relative;
overflow: hidden;
}
.tiles-box {
margin-bottom: 30px;
line-height: 0;
text-align: left;
}
.descr {
width: 100%;
height: 140px;
position: absolute;
z-index: 1000;
bottom: -140px;
background-image: linear-gradient(to top, #000, rgba(0,0,0,.01));
color: #fff;
text-align: center;
transition: all .3s ease;
}
.descr h3 {
color: #fff;
line-height: 140px;
font-size: 22px;
font-weight: 400;
}
@media(min-width: 320px) {
.tiles-box {
display: none;
}
}
@media(min-width: 768px) {
.mob-list-projects {
display: none;
}
.tiles-box,.color-bw, .descr {
display: block;
}
.col-1-3, .col-2-3 {
height: 260px;
}
.tiles-box img {
width: 100%;
height: auto;
}
.col-1-3 {
width: 50%;
}
.col-2-3 {
width: 100%;
}
.col-1-3:hover .descr, .col-2-3:hover .descr {
transition: all .3s ease;
bottom: 0;
}
}
@media(min-width: 1200px) {
.col-1-3 {
width: 33.33%;
}
.col-2-3 {
width: 66.66%;
}
}
/* Get in touch Section */
form,
.social-col,
.social-col,
.social-col ul,
.social-col li,
input[type="text"],
input[type="email"],
span.icons {
display: inline-block;
}
input[type="text"], input[type="email"], textarea, button {
height: 50px;
margin-bottom: 12px;
font: inherit;
letter-spacing: inherit;
padding: 0 15px;
border-radius: 4px;
outline: none;
border: none;
}
textarea {
display: block;
width: 100%;
height: 200px;
}
.social-col {
text-align: left;
}
.social-col li {
padding-right: 20px;
}
span.icons {
width: 50px;
height: 50px;
border-radius: 50%;
color: #fff;
text-align: center;
line-height: 50px;
font-size: 30px;
}
.fa-twitter {
background-color: #3498db;
}
.fa-facebook {
background-color: #343bba;
}
.fa-codepen {
background-color: #34495e;
}
.fa-vk {
background-color: #3462cc;
}
.fa-google {
background-color: #c0392b;
}
.fa-git {
background-color: #172829;
}
@media(min-width: 320px) {
input[type="text"], input[type="email"] {
width: 100%;
}
.social-col li {
padding-bottom: 20px;
}
form, .social-col {
width: 100%;
text-align: center;
vertical-align: top;
}
form {
margin-bottom: 30px;
}
.social-col {
padding-left: 0;
}
}
@media(min-width: 768px) {
.social-col li {
padding-bottom: 0;
}
.br-icons {
display: inline-block;
}
input[type="text"], input[type="email"] {
width: 49%;
}
input[type="text"] {
margin-right: 2%;
}
}
@media(min-width: 1200px) {
.social-col li {
padding-bottom: 20px;
}
.contacts {
}
form {
width: 730px;
}
.br-icons {
display: block;
}
form, .social-col {
text-align: left;
vertical-align: top;
}
.social-col {
display: inline-block;
width: calc(100% - 730px);
padding-left: 100px;
}
}
/* Footer */
footer {
padding: 40px;
}
small {
font-size: 14px;
}
/* Bottoms */
.btn {
display: inline-block;
background-color: #e74c3c;
border-radius: 4px;
line-height: 40px;
height: 40px;
padding: 0 30px;
text-decoration: none;
color: #fff;
font-weight: 900;
cursor: pointer;
transition: all .3s ease;
}
.btn:hover {
background-color: #d62d1a;
transition: all .3s ease;
}
/* User's styles */
.under-line {
padding-bottom: 10px;
border-bottom: 2px solid #e74c3c;
}
.slash {
color: #e74c3c;
}
$(document).ready(function(){
// For touchscreens. Recoment the code using by mobile devices
/*$(document).on("touchstart",".mob-nav", function() {
if ($(".dropDN-menu").css("display") === "none") {
$(".dropDN-menu").css("display", "block");
} else {
$(".dropDN-menu").css("display", "none");
}
});*/
// Drop down menu on mobile screens
$(".mob-nav").click(function() {
if ($(".dropDN-menu").css("display") === "none") {
$(".dropDN-menu").css("display", "block");
} else {
$(".dropDN-menu").css("display", "none");
}
});
$(".dropDN-menu a").click(function() {
$(".dropDN-menu").css("display","none");
});
// scroll, shodow effects
if ($(window).width() >= 768) {
var lastId,
topNav = $("#nav"),
topMenuHeight = topNav.outerHeight();
menuItems = $(".header a");
scrollItems = menuItems.map(function() {
var item = $($(this).attr("href"));
if (item.length) {
return item;
}
});
menuItems.click(function(e){
var href = $(this).attr("href"),
offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
$('html, body').stop().animate({
scrollTop: offsetTop
}, 500);
e.preventDefault();
});
$(window).scroll(function() {
var fromTop = $(this).scrollTop() + topMenuHeight;
var cur = scrollItems.map(function() {
if ($(this).offset().top < fromTop) {
return this;
}
});
cur = cur[cur.length-1];
var id = cur && cur.length ? cur[0].id : "";
if (lastId !== id) {
lastId = id;
menuItems.removeClass("under-line").filter("[href='#"+id+"']").addClass("under-line");
}
});
// effect for portfolio section
$(".item").mouseenter(function() {
$(".color").css("display","none");
$(this).find(".color").css("display","block");
});
$(".item").mouseleave(function() {
$(".color").css("display","block");
});
// Shadow effect below header
$(window).scroll(function() {
if ($(window).scrollTop() > 70) {
topNav.addClass("head-shadow");
} else {
topNav.removeClass("head-shadow");
}
});
};
});
Also see: Tab Triggers