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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<title>Yoga</title>
</head>
<body>
<a href="#" class="scrolltop" id="scroll-top">
<i class="fa-solid fa-chevron-up scrolltop__icon"></i>
</a>
<section class="hero-sec">
<div class="header">
<nav class="nav">
<div class="logo">
<img src="" alt="" class="logo-img">
<span>Yoga coach<br>
for your health</span>
</div>
<div class="contact-header">
<div class="social-header">
<a href=""><i class="fa-brands fa-facebook-f"></i></a>
<a href=""><i class="fa-brands fa-youtube"></i></a>
<a href=""><i class="fa-brands fa-instagram"></i></a>
<a href=""><i class="fa-brands fa-telegram"></i></a>
</div>
<span class="phone-header">+380 (98) 395 44 20</span>
<div class="menu-btn menu">
<div class="menu-btn__burger">
</div>
</div>
</div>
</nav>
</div>
<div class="hero container">
<h1 class="hero-title">Sofia Vikentieva</h1>
<p class="hero-text">Lorem ipsum dolor sit amet, consectetur adipisicing <br>
do eiusmod tempor incididunt ut labore et dolore magna <br>
Ut enim ad minim veniam, quis nostrud</p>
<a href="#" class="btn"><span>Buy a Workout</span></a>
</div>
</section>
<div class="menu-content">
<nav class="menu-nav">
<ul class="menu-list">
<li ><a data-goto=".hero-sec" href="#" class="menu-link">Home</a></li>
<li><a data-goto=".what-do" href="#" class="menu-link">What do you get</a></li>
<li><a data-goto=".bio" href="#" class="menu-link">Bio</a></li>
<li><a data-goto=".classes" href="#" class="menu-link">Yoga classes</a></li>
<li><a data-goto=".tea" href="#" class="menu-link">Tea ceremony</a></li>
<li><a data-goto=".coast" href="#" class="menu-link">The coast</a></li>
</ul>
</nav>
</div>
<section class="what-do">
<div class="container">
<h1 class="title">What do you get</h1>
<div class="pose">
<div class="pose-item">
<img src="img/lotus.png" alt="" class="pose-img">
<span class="pose-title">Lotus pose</span>
<p class="pose-text">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="pose-item">
<img src="img/extended.png" alt="" class="pose-img">
<span class="pose-title">Lotus pose</span>
<p class="pose-text">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="pose-item">
<img src="img/crow.png" alt="" class="pose-img">
<span class="pose-title">Lotus pose</span>
<p class="pose-text">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="pose-item">
<img src="img/relax.png" alt="" class="pose-img" width="103" height="77">
<br>
<br>
<div class="posa-text">
<span class="pose-title">Lotus pose</span>
<p class="pose-text">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
</div>
</div>
</div>
</section>
<section class="bio">
<div class="container bio-container">
<div class="bio-info_items">
<h1 class="bio-title">My BIO</h1>
<p class="bio-text">Lorem ipsum dolor sit amet, consectetur adipisicing<br>
do eiusmod tempor incididunt ut labore et dolore magna<br>
Ut enim ad minim veniam, quis nostrud</p>
<div class="bio-info">
<div class="bio-item">
<img src="img/paint.png" alt="">
<span>Painting</span>
</div>
<div class="bio-item">
<img src="img/monitor.png" alt="">
<span>Web-Design</span>
</div>
<div class="bio-item">
<img src="img/surf.png" alt="">
<span>Surfing</span>
</div>
<div class="bio-item">
<img src="img/paw.png" alt="">
<span>Love Dogs</span>
</div>
</div>
<a href="" class="btn">Hire me</a>
</div>
<div class="bio-img">
<img src="img/bio.jpg" alt="">
</div>
</div>
</section>
<section class="classes">
<div class="container">
<h1 class="title">Yoga Classes</h1>
<div class="classes-container">
<div class="classes-items">
<div class="class-item">
<div class="class-text">
<h1 class="class-item_title">Hatha Yoga</h1>
<p class="class-time_title">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="arrow-btn_container">
<a href="" class="btn arrow-btn"><i class="fa-solid fa-arrow-right-long"></i></a>
</div>
</div>
<div class="class-item">
<div class="class-text">
<h1 class="class-item_title">Hatha Yoga</h1>
<p class="class-time_title">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="arrow-btn_container">
<a href="" class="btn arrow-btn"><i class="fa-solid fa-arrow-right-long"></i></a>
</div>
</div>
<div class="class-item">
<div class="class-text">
<h1 class="class-item_title">Hatha Yoga</h1>
<p class="class-time_title">Lorem ipsum dolor sit<br>
usmod tempor incididunt ut lab<br>
Ut enim ad minim veniam</p>
</div>
<div class="arrow-btn_container">
<a href="" class="btn arrow-btn"><i class="fa-solid fa-arrow-right-long"></i></a>
</div>
</div>
</div>
<div class="classes-img">
<img src="img/waterfall.jpg" alt="">
</div>
</div>
</div>
</section>
<section class="tea">
<div class="container">
<div class="tea-container">
<h1 class="tea-title">Tea ceremony</h1>
<div class="tea-img">
<img src="img/tea.jpg" alt="">
</div>
<p class="tea-text">Lorem ipsum dolor sit amet, consectetur adipisicing<br>
do eiusmod tempor incididunt ut labore et dolore magna<br>
Ut enim ad minim veniam, quis nostrud</p>
<div class="arrow-btn_container">
<a href="" class="btn arrow-btn tea-arrow"><i class="fa-solid fa-arrow-right-long"></i></a>
</div>
</div>
</div>
</section>
<section class="coast" id="coast">
<div class="container">
<h1 class="title">The coast</h1>
<div class="coast-items">
<div class="coast-item">
<h1 class="coast-tarif">One lesson</h1>
<span class="coast-price">15$</span>
<a href="" class="btn coast-btn">Buy</a>
</div>
<div class="coast-item">
<h1 class="coast-tarif">Individual</h1>
<span class="coast-price">15$</span>
<a href="" class="btn coast-btn">Buy</a>
</div>
<div class="coast-item">
<h1 class="coast-tarif">Subscrition Pro</h1>
<span class="coast-price">15$</span>
<a href="" class="btn coast-btn">Buy</a>
</div>
</div>
</div>
</section>
<footer class="footer">
<nav class="nav nav-footer">
<div class="logo">
<img src="img/logo.png" alt="" class="logo-img">
<span>Yoga coach<br>
for your health</span>
</div>
<div class="contact-header">
<div class="social-header">
<a href=""><i class="fa-brands footer-social fa-facebook-f"></i></a>
<a href=""><i class="fa-brands footer-social fa-youtube"></i></a>
<a href=""><i class="fa-brands footer-social fa-instagram"></i></a>
<a href=""><i class="fa-brands footer-social fa-telegram"></i></a>
</div>
<span class="phone-header">+380 (98) 395 44 20</span>
</div>
</nav>
</footer>
<script src="/js/script.js"></script>
<script src="https://kit.fontawesome.com/52dc00baf2.js" crossorigin="anonymous"></script>
</body>
</html>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
body {
font-family: 'Montserrat', sans-serif;
color: #000;
}
a {
text-decoration: none;
}
li {
list-style: none;
}
h1 {
font-weight: 900;
}
body._lock {
overflow: hidden;
}
.container {
padding: 0 160px 0 160px;
}
.btn {
color: #fff;
background-color: #ff803b;
font-weight: 900;
font-size: 14px;
padding: 15px 30px;
border: 2px solid #ff803b;
transition: all .4s ease;
}
.btn:hover {
background-color: #ff803b;
color: #fff;
border-radius: 5px;
-webkit-box-shadow: 0px 0px 33px 4px rgba(255, 128, 59, 0.43);
-moz-box-shadow: 0px 0px 33px 4px rgba(255, 128, 59, 0.43);
box-shadow: 0px 0px 33px 4px rgba(255, 128, 59, 0.43);
}
.title {
text-align: center;
font-size: 36px;
}
.hero-sec {
width: 100%;
height: 100vh;
background: url('https://fastpic.org/view/117/2022/0518/_55870edc90bf4f57ff8cf91dbe656ac7.jpg.html') no-repeat;
background-position: center;
background-size: cover;
}
.header {
padding: 0 120px;
}
.nav {
padding-top: 50px;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
}
.logo span {
color: #fff;
padding-left: 10px;
}
.contact-header {
display: flex;
align-items: center;
}
.social-header {
font-size: 24px;
padding-right: 70px;
}
.fa-brands {
color: #fff;
padding-right: 20px;
transition: all .3s ease;
}
.fa-brands:hover {
color: rgba(255, 255, 255, 0.486);
}
.phone-header {
font-weight: 900;
color: #fff;
padding-right: 70px;
}
/*========== BURGER MENU ==========*/
.menu-btn {
width: 50px;
height: 50px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
z-index: 5;
transition: all .2s ease-in-out;
transition: all .3s ease;
}
.menu-btn__burger {
width: 30px;
height: 3px;
background: #000;
border-radius: 5px;
transition: all .2s ease-in-out;
}
.menu-btn__burger::before,
.menu-btn__burger::after {
content: '';
position: absolute;
width: 30px;
height: 3px;
background: #000;
border-radius: 5px;
transition: all .2s ease-in-out;
}
.menu-btn__burger::before {
transform: translateY(-10px);
}
.menu-btn__burger::after {
transform: translateY(10px);
}
.menu-btn.open .menu-btn__burger {
transform: translateX(-50px);
background: transparent;
}
.menu-btn.open .menu-btn__burger::before {
transform: rotate(45deg) translate(35px, -35px);
}
.menu-btn.open .menu-btn__burger::after {
transform: rotate(-45deg) translate(35px, 35px);
}
/*========== HERO ==========*/
.hero {
padding-top: 150px;
}
.hero-title {
font-size: 42px;
}
.hero-text {
padding: 25px 0 40px 0;
}
/*========== What do you do ==========*/
.what-do {
padding-top: 100px;
}
.pose {
padding-top: 75px;
display: flex;
justify-content: space-between;
}
.pose-item {
position: relative;
display: flex;
flex-direction: column;
text-align: center;
}
.pose-img {
display: block;
margin-left: auto;
margin-right: auto;
}
.pose-title {
font-weight: 900;
padding-top: 25px;
}
.pose-text {
padding-top: 10px;
}
/*========== BIO ==========*/
.bio {
margin-top: 100px;
background-color: #ece7f2;
}
.bio-container {
display: flex;
justify-content: space-between;
padding: 75px 160px;
}
.bio-title {
color: #5e5568;
font-size: 32px;
padding: 50px 0 35px 0;
}
.bio-taxt {
padding: 20px 0 35px 0;
}
.bio-info {
padding: 50px 0;
}
.bio-item {
padding-bottom: 25px;
}
/*========== YOGA CLASSES ==========*/
.classes {
padding: 100px 0;
}
.classes-container {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 100px;
}
.classes-items {
display: grid;
row-gap: 50px;
}
.class-item {
position: relative;
display: flex;
justify-content: space-between;
}
.class-item_title {
font-size: 18px;
padding-bottom: 15px;
}
.arrow-btn {
padding: 2px 10px;
position: absolute;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
.arrow-btn_container {
margin-left: 70px;
}
/*========== TEA ==========*/
.tea {
width: 100%;
height: 170vh;
background: url('/img/tea_bg.jpg') no-repeat;
background-size: cover;
background-position: center;
color: #fff;
}
.tea-container {
padding-top: 100px;
position: relative;
}
.tea-title {
font-size: 36px;
}
.tea-img img {
padding: 60px 0 70px 0;
width: 100%;
}
.tea-arrow {
margin-left: 450px;
}
/*========== THE COAST ==========*/
.coast {
padding: 100px 0 100px 0;
}
.coast-items {
padding-top: 150px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.coast-item {
padding: 50px 0 80px 50px;
width: 300px;
display: flex;
flex-direction: column;
-webkit-box-shadow: 0px 0px 28px 8px rgba(34, 34, 34, 0.11);
-moz-box-shadow: 0px 0px 28px 8px rgba(34, 34, 34, 0.11);
box-shadow: 0px 0px 28px 8px rgba(34, 34, 34, 0.11);
}
.coast-title {
font-size: 16px;
}
.coast-tarif {
font-size: 18px;
padding-bottom: 15px;
}
.coast-btn {
margin-top: 15px;
width: 95px;
}
/*========== FOOTER ==========*/
.footer {
background-color: #ece7f2;
}
.nav-footer {
padding: 100px 120px;
}
.footer span {
color: #000;
}
.footer-social {
color: #000;
}
.footer-social:hover {
color: rgba(0, 0, 0, 0.409);
}
/*========== SCROLL TO TOP ==========*/
.scrolltop {
position: fixed;
right: 1rem;
bottom: -20%;
display: flex;
justify-content: center;
align-items: center;
padding: .3rem;
background: #d5b4ff8e;
border-radius: .4rem;
z-index: 10;
transition: .3s;
visibility: hidden;
}
.scrolltop:hover {
background-color: #d5b4ff;
}
.scrolltop__icon {
font-size: 1.8rem;
padding: 0 2px;
color: rgba(255, 255, 255, 0.443);
transition: all .3s ease;
}
.scrolltop__icon:hover {
color: #fff;
}
.show-scroll {
visibility: visible;
bottom: 1.5rem;
}
/*========== MENU ==========*/
.menu-content {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 100px;
background-color: rgba(0, 0, 0, 0.9);
display: none;
transition: all .3s ease;
}
.menu-content._active {
display: block;
transition: all .3s ease;
}
.menu-nav {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.menu-list {
display: grid;
row-gap: 30px;
}
.menu-link {
font-weight: 900;
font-size: 24px;
color: #fff;
transition: all .3s ease;
}
.menu-link:hover {
color: rgba(255, 255, 255, 0.135);
}
const menuBtn = document.querySelector('.menu-btn');
let menuOpen = false;
menuBtn.addEventListener('click', ()=> {
if(!menuOpen) {
menuBtn.classList.add('open');
menuOpen=true;
}
else {
menuBtn.classList.remove('open');
menuOpen=false;
}
})
const menu = document.querySelector('.menu-btn');
const menuBody = document.querySelector('.menu-content');
if (menuBtn) {
menuBtn.addEventListener("click", function (e) {
menu.classList.toggle('_active');
menuBody.classList.toggle('_active');
document.body.toggle('_lock');
});
}
if (menuBtn.classList.contains('_active')) {
menu.classList.remove('_active');
menuBody.classList.remove('_active');
document.body.remove('_lock');
}
const menuLinks = document.querySelectorAll('.menu-link[data-goto]');
if (menuLinks.length > 0) {
menuLinks.forEach(menuLink =>{
menuLink.addEventListener("click", onMenuLinkClick);
})};
function onMenuLinkClick(e) {
const menuLink = e.target;
if (menuLink.dataset.goto && document.querySelector(menuLink.dataset.goto)) {
const gotoBlock = document.querySelector(menuLink.dataset.goto);
const gotoBlockValue = gotoBlock.getBoundingClientRec().top + pageYOffset - document.querySelector('.hero-sec').offsetHeight;
window.scrollTo({
top: gotoBlockValue,
behavior: 'smooth'
});
e.preventDefault();
}
}
function scrollTop(){
const scrollTop = document.getElementById('scroll-top');
if(this.scrollY >= 150) scrollTop.classList.add('show-scroll'); else scrollTop.classList.remove('show-scroll')
}
window.addEventListener('scroll', scrollTop)
Also see: Tab Triggers