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 URL's 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 it's URL and the proper URL extention.
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.
<header id="header" class="d-flex align-items-center scroll-Active">
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" style="background-color:#77a8a8" id="nav-bar">
<div class="container-fluid">
<a class="navbar-brand" href="#page-top"><img id="header-img" src="https://lh3.googleusercontent.com/XASV0g9oq7hluQSk8--CFpNEL3ro6yXJaWYfa9HlN8QpL8agKN_xmo4TJ8iHHeaF3HrJSiHltPugSxDkPT6iWLIR1x9dILDKZc8TATLSZ5nWPewsTfj7BKD8pg6ugZtXrd98zH7R-A=s64-p-k" width="40px" alt="logo" /> <span class="hidden-sm-down">Succulent Seeker</span> <span class="hidden-md-up"> SS </span></a>
<div class="" id="navbarResponsive">
<ul class="navbar-expand navbar-nav ml-auto">
<li class="nav-item pl-2 pr-2">
<a class="nav-link js-scroll-trigger" href="#header"><i class="fas fa-home hidden-md-up" style="font-size:1.5em"></i><span class="hidden-sm-down"> Home</span></a>
</li>
<li class="nav-item pl-2 pr-2">
<a class="nav-link js-scroll-trigger" href="#Product"> <i class="fas fa-list-alt hidden-md-up" style="font-size:1.5em"></i> <span class="hidden-sm-down">Product </span></a>
</li>
<li class="nav-item pl-2 pr-2">
<a class="nav-link js-scroll-trigger" href="#Tutorial"><i class="fas fa-video hidden-md-up" style="font-size:1.5em"></i><span class="hidden-sm-down">Tutorial Video </span></a>
</li>
<li class="nav-item pl-2 pr-2" style="border-bottom:1px solid #622569;">
<div class="cart text-center">
<i class="fa fa-shopping-basket fa-2x shopping-cart"></i>
<i class="fa fa-caret-down"></i>
<!--br-->
<span id="items-basket">0</span>
</div>
<div id="cart-items" class="card text-center col-lg-3 col-md-3 col-sm-6 col-xs-6 offset-sm-1" style="background-color:#77a8a8">
<div class="card-body">
<span id="emptyCart">Your shopping cart is EMPTY </span>
<ol class="list-group list-group-flush" id="list-item"></ol>
</div>
<div class="card-title">Total : <span id="total-price">$0</span></div>
<div class="card-body d-flex">
<span id="email-me"> Email me the list </span>
<form class="form-inline justify-content-center" id="form">
<div class="form-group row">
<input type="email" id="inputemail" class="form-control" placeholder="name@example.com"> <i class="fas fa-paper-plane m-2"></i>
</div>
</form>
</div>
</div>
</li>
</ul>
</div>
</div>
</nav>
<div class="container text-center">
<div class="row align-left my-auto">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 justify-content-center pt-5 pb-5 py-5" style="background-color:#b0aac0; opacity:0.9">
<h2 class="align-left" style="color:#622569"><strong>Succulent Seeker</strong></h2>
<h4 class=" align-left"><strong>THINKING OF BUYING A PLANT?</strong></h4>
<button type="button" class="btn btn-lg btn-default" style="background-color:#EAB543" id="checkout">Check Now</button>
</div>
</div>
</div>
</header>
<section id="Product">
<div class="container-fluid">
<div class="row mt-6 mb-3">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h2 class="align-left">
Product list
</h2>
</div>
</div>
<div class="row justify-content-center align-items-start">
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://www.broadviewflower.com/wp-content/uploads/2018/02/succulent-plant.jpg" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/I7ovxWdJH95VEOjWQpHLA5E_uxQFdX6LO5g03T0ChGOOFCkqwSrFwFA5sbyJycB_8SmdHIMDdaqoZPY-cSl1NREr5I07irn_qiYl3h10LninxBqGEMhFNDKwuFEg0NyHq58pVaZ4ZQ=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/o-yhCf_xw9dSxEZsYQLJ3EtNANUK6MVfp1SeeW9zgA3mTHSOpfbtKr3blDwI0cZGLI5XrElLXQU8A-d-z6eDUQCoWnY8dvjZ6mPkc11qc7Cd1-Pn8FDaKEtKx_V9tzFrJN2OhGGOkg=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/Lxg0AO_2cYNvtIeRo1XFi_GZcm1xzC9wWUWNbSvqdFPKQcg_CBLEXGnYKKjPR723Qz5x90v1FJEumso49uNtbTQcH_PaIo7U3bfhiMjVRClTpg4bZiqLICAth5HVd4pMTEnQuMUDIg=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/SXt5pWVzehAOJKRbDEeoRKRZfJLZiARab4cU6q6eGhBUMcYbZAB32qHXsikKs8lXaDFDZkjA7xCZF10vW_XDKjaVxf1fVcwkpK7HFKj9xL_9WgmqDtMvTJZ9OECKhUtEILRrq954gg=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/vpNafP1g1w8xawqC_DtKlF1oVg6Yq9MeQnr3hg8r2pw4r7P1sSEHXe9rLoYdYvISs2L4wal80tRXEOwmo_T5eHBq4loahIsM6bbesplFiHMr1j4S3-I2jRk73mWOYhaMHLjQqoDlGA=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/s-aV0AscfvAPvvkGOwwdg21YR4ynpkqNDEodbxu4Gk5AQH6xizTlkChm2-UpR1n0c1XbMwoQPZ3tkoOulvzOQUqFkS2uHbVEqUuaiBbtA1BC6Ue47qsVlXfUDyoz-ZJK6eWFXVxk7Q=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 mb-3 mt-3">
<div class="item">
<img class="img-thumbnail" src="https://lh3.googleusercontent.com/2gTgHD2LXxvTika2mmHnPbPK3rjUsWtb5K5E1YPeF-3ghw4CuG6Bev5bBRPoFdbv2jTfGJqm69b48kEgIsOUOJfmKQuITTK-YiFyA9wXNq4lAZ5pIqybVn-jo_EE14WCSuAlY8d1qg=w2400" alt="" />
<div class="row text-center">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h4 class="product-name">Product title</h4>
</div>
<div class="col-lg-6 col-md-6 product-price">
$15.00
</div>
<div class="col-lg-6 col-md-6">
<button class="btn add-to-cart" type="button">Add to cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="Tutorial">
<div class="container-fluid d-flex flex-column">
<div class="row mt-3 mb-3">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h2 class="align-left">
Tutorial video
</h2>
</div>
</div>
<div class="row justify-content-center align-items-start">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="embed-responsive embed-responsive-16by9">
<iframe id="video" class="embed-responsive-item" style="border: 1px solid #dee2e6;
border-radius: 0.25rem;" src="https://www.youtube.com/embed/AazGHjPqgLs?wmode=transparent&rel=0&showinfo=0" allowfullscreen=""></iframe>
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="container">
<div class="row mt-3">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 d-flex justify-content-center align-items-center my-auto footer">
<ul class="navbar-expand navbar-nav">
<li class="nav-item pl-2 pr-2">
<a href="https://www.linkedin.com/in/monikapatelit/" target="_blank"><i class="fab fa-linkedin"></i></a>
</li>
<li class="nav-item pl-2 pr-2">
<a href="https://www.freecodecamp.org/monikapatelit" target="_blank"><i class="fab fa-free-code-camp"></i></a>
</li>
<li class="nav-item pl-2 pr-2" style="border-bottom:1px solid gray;">
Designed with
<i class="fab fa-gratipay"></i> by <a href="https://codepen.io/IamMonikaPatel/" target="_blank"> Monika Patel </a>
</li>
</ul>
</div>
</div>
</div>
</footer>
html,
body {
height: 100%;
}
#header {
height: 100%;
background: url("https://lh3.googleusercontent.com/YzcQ5fuqG-STPggRVhnm96ffunFXvZGtnz7R8de5WVFxUEeArmlXv4oM7EiOyoGeIAy9mzQh4TAMqLljz-MLBmCZvc85qfVXLHpNn6pcTXd1tJQCZ9M_FRm5k5J2-bo7z2a5JIfCCg=w2400") no-repeat center center fixed;
background-size: cover;
}
#header-img {
max-width: 50%;
max-height: 50%;
animation-duration: 1s;
animation-name: Rotateme;
animation-iteration-count: infinite;
}
#email-me, #form {
display: none;
}
section {
min-height: 100%;
}
#header-img:hover {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
}
footer {
align-self: flex-end;
width: 100%;
position: relative;
background-color: #77a8a8;
}
.footer a {
color: black;
}
/*Logo image rotation*/
@keyframes Rotateme {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(90deg);
}
50% {
transform: rotate(270deg);
}
75% {
transform: rotate(180deg);
}
100% {
transform: rotate(360deg);
}
}
.navbar-brand {
color: #622569 !important;
font-weight: 800;
font-size: 2em;
}
section h2 {
color: #EAB543 !important;
text-transform: capitalize;
}
.nav-link {
color: #622569 !important;
font-weight: 500;
font-size:1.3em;
}
.nav-link.active {
color: #EAB543 !important;
font-weight: 500;
}
.add-to-cart {
border: 1px solid #b0aac0;
background-color: #622569;
color: white;
}
.add-to-cart:hover {
background-color: #b0aac0;
}
/*Shopping cart card effect*/
#cart-items {
position: absolute;
top: 90%;
right: 0%;
z-index: 999;
border: 0px !important;
display: none;
color: #622569;
}
#items-basket {
position: absolute;
display: none;
top: -5px;
left: -10px;
width: 1.45rem;
height: 1.25rem;
border-radius: 50%;
background: red;
color: white;
cursor: pointer;
}
.remove {
cursor: pointer;
}
.cart {
float: right;
text-align: center;
color: #622569;
position: relative;
}
.remove {
color: Red;
}
/* Hidden and visible elemnt from Bootsrap3.0 */
/*\
* Restore Bootstrap 3 "hidden" utility classes.
\*/
/* Breakpoint XS */
@media (max-width: 575px) {
.hidden-xs-down, .hidden-sm-down, .hidden-md-down, .hidden-lg-down, .hidden-xl-down,
.hidden-xs-up,
.hidden-unless-sm, .hidden-unless-md, .hidden-unless-lg, .hidden-unless-xl {
display: none !important;
}
#header {
background-position: 80% 80%;
}
}
/* Breakpoint SM */
@media (min-width: 576px) and (max-width: 767px) {
.hidden-sm-down, .hidden-md-down, .hidden-lg-down, .hidden-xl-down,
.hidden-xs-up, .hidden-sm-up,
.hidden-unless-xs, .hidden-unless-md, .hidden-unless-lg, .hidden-unless-xl {
display: none !important;
}
#header {
background-position: 80% 80%;
}
}
/* Breakpoint MD */
@media (min-width: 768px) and (max-width: 991px) {
.hidden-md-down, .hidden-lg-down, .hidden-xl-down,
.hidden-xs-up, .hidden-sm-up, .hidden-md-up,
.hidden-unless-xs, .hidden-unless-sm, .hidden-unless-lg, .hidden-unless-xl {
display: none !important;
}
#header {
background-position: 80% 80%;
}
}
/* Breakpoint LG */
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-lg-down, .hidden-xl-down,
.hidden-xs-up, .hidden-sm-up, .hidden-md-up, .hidden-lg-up,
.hidden-unless-xs, .hidden-unless-sm, .hidden-unless-md, .hidden-unless-xl {
display: none !important;
}
}
/* Breakpoint XL */
@media (min-width: 1200px) {
.hidden-xl-down,
.hidden-xs-up, .hidden-sm-up, .hidden-md-up, .hidden-lg-up, .hidden-xl-up,
.hidden-unless-xs, .hidden-unless-sm, .hidden-unless-md, .hidden-unless-lg {
display: none !important;
}
}
(function ($) {
"use strict"; // Start of use strict
// Smooth scrolling using jQuery easing
$('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function () {
if (
location.pathname.replace(/^\//, "") ==
this.pathname.replace(/^\//, "") &&
location.hostname == this.hostname
) {
var target = $(this.hash);
target = target.length ? target : $("[name=" + this.hash.slice(1) + "]");
if (target.length) {
$("html, body").animate(
{
scrollTop: target.offset().top - 80
},
1000,
"easeInOutExpo"
);
return false;
}
}
});
// Closes responsive menu when a scroll trigger link is clicked
$(".js-scroll-trigger").click(function () {
$(".navbar-collapse").collapse("hide");
});
// Activate scrollspy to add active class to navbar items on scroll
$("body").scrollspy({
target: "#nav-bar",
offset: 80
});
})(jQuery); // End of use strict
//Navigate to product list
$("#checkout").click(function () {
$("html,body").animate(
{ scrollTop: $("#Product").offset().top - 80 },
"slow"
);
});
$(".navbar-brand").click(function () {
$("html,body").animate({ scrollTop: $("#header").offset().top - 80 }, "slow");
});
/* slide toggle cart details */
$(".cart").on("click", function (e) {
$("#cart-items").slideToggle(); // onn basckaet click show
e.stopPropagation();
});
//Slide cart-items up when click out side cart-items div
$(document).click(function () {
$('#cart-items').slideUp();
});
/*Add to cart effect Reference from https://codepen.io/elmahdim/pen/tEeDn */
$(".add-to-cart").on("click", function () {
var cart = $(".shopping-cart");
var imgtodrag = $(this)
.closest(".item")
.find("img")
.eq(0);
if (imgtodrag) {
var imgclone = imgtodrag
.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
opacity: "0.7",
position: "absolute",
height: "150px",
width: "150px",
"z-index": "1033"
})
.appendTo($("body"))
.animate(
{
top: cart.offset().top,
left: cart.offset().left,
width: 50,
height: 50
},
1000,
"easeInOutExpo",
function() {
//number of items in basket
$("#items-basket")
.text($("#list-item").children().length)
.css("display", "table");
$("#emptyCart").css("display", "none");
}
);
imgclone.animate(
{
width: 0,
height: 0
},
function () {
$(this).detach();
}
);
}
//add items to basket
$("#cart-items").slideUp();
$(this).each(function () {
var name = $(this)
.parents(".item")
.find(".product-name")
.text();
var price =
"<span class='eachPrice'>" +
$(this)
.parents(".item")
.find(".product-price")
.text() +
"</span>";
var remove = "<span class='remove'> <i class='fas fa-times-circle'></i> </span>";
$("#list-item").append(
"<li>" +
name +
"	 - 	" +
price +
"	 - 	" +
remove +
"</li>"
);
//number of items in basket
/* $("#items-basket")
.text($("#list-item").children().length)
.css("display", "table");
$("#emptyCart").css("display", "none");*/
});
/* Calculate total price for cart items list*/
var totalPrice = 0;
$(".eachPrice").each(function () {
var pricePerItem = parseFloat(
$(this)
.text()
.replace("$", "")
);
totalPrice += pricePerItem;
});
$("#total-price").text("$" + totalPrice);
//remove item from basket
$(".remove").on("click", function (e) {
$(this)
.parent()
.remove();
// Re -Calculate total of the exisitng items
var totalPrice = 0;
$(".eachPrice").each(function () {
var pricePerItem = parseFloat(
$(this)
.text()
.replace("$", "")
);
totalPrice += pricePerItem;
});
$("#total-price").text("$" + totalPrice);
//Change text for emapty cart
var totalItem = $("#list-item").children().length;
if (totalItem > 0) {
$("#items-basket")
.text(totalItem)
.css("display", "table");
} else {
$("#items-basket").css("display", "none");
$("#emptyCart").css("display", "block");
}
e.stopPropagation();
});
});
Also see: Tab Triggers