<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modern Website</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header class="header">
<nav class="nav" id="nav">
<!-- Add your menu items here -->
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</nav>
</header>
<div class="background-video">
<video autoplay muted loop>
<source src="https://drive.google.com/uc?export=download&id=17tDNnV1pARr09dP1Wfh1QKhqsQIHWbm9" type="video/mp4">
</video>
</div>
<section class="hero-section">
<img src="https://images.contentstack.io/v3/assets/blt731acb42bb3d1659/blt8979808f7798ecf5/6216ee875fe07272a8a2447a/2021_Key_art.jpg">
<h1 class="hero-title">League of Legends</h1>
</section>
<section class="content-section">
<!-- Add your content here -->
<h1>Welcome to Our Website</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</section>
<script src="scripts.js"></script>
</body>
</html>
// Define custom variables for colors, dimensions, etc.
$primary-color: rgba(0, 0, 0, 0.7);
$nav-height: 60px;
$mirror-border: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
$mirror-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
// Reset CSS styles for consistent cross-browser rendering
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
// Set the font family for the body
body {
font-family: Arial, sans-serif;
}
// Styles for the header
.header {
position: fixed; // Fix the header at the top of the page
top: 0;
left: 0;
width: 100%;
height: $nav-height;
background-color: $primary-color;
z-index: 100; // Ensure header is above other content
display: flex;
justify-content: center;
align-items: center;
// Styles for the navigation menu
.nav {
display: flex;
justify-content: space-around;
align-items: center;
// Styles for navigation links
a {
font-size: 18px;
text-decoration: none;
color: white;
padding: 10px;
border-bottom: 1px solid transparent;
transition: all 0.3s;
// Styles for navigation links on hover
&:hover {
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
}
}
}
// Styles for the background video container
.background-video {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: -1;
// Styles for the video element
video {
object-fit: cover;
width: 100%;
height: 100%;
}
}
// Styles for the hero section
.hero-section {
position: relative;
min-height: 100vh;
padding-top: $nav-height;
// Styles for the background image
img {
object-fit: cover;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
// Styles for the parallax effect hero title
.hero-title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 4em;
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
transition: all 0.3s;
}
// Styles for the hidden state of the hero title
.hide {
visibility: hidden;
opacity: 0;
}
}
// Styles for the content section
.content-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
padding-top: $nav-height;
background-color: rgba(255, 255, 255, 0.7);
border-image: $mirror-border;
border-image-slice: 1;
border-width: 2px;
box-shadow: $mirror-box-shadow;
border-radius: 10px;
margin: 20px;
}
View Compiled
//Hero title dissapear functionality - Paralax effect
document.addEventListener("DOMContentLoaded", function () {
const heroTitle = document.querySelector(".hero-title");
const contentSection = document.querySelector(".content-section");
window.addEventListener("scroll", function () {
const contentTop = contentSection.getBoundingClientRect().top;
const scrollPercentage = 1 - contentTop / window.innerHeight;
if (scrollPercentage >= 0) {
heroTitle.style.transform = `translate(-50%, calc(-50% + ${scrollPercentage * 100}px))`;
heroTitle.style.opacity = 1 - scrollPercentage;
}
if (scrollPercentage >= 1) {
heroTitle.classList.add("hide");
} else {
heroTitle.classList.remove("hide");
}
});
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.