Mini Project
Mini Project
The digital landscape has revolutionized the way businesses operate, enabling
them to connect with customers globally. In this project, we present a modern,
feature-rich website designed to provide a seamless user experience with
interactive navigation, dynamic visual effects, and responsive design principles.
The goal of this project is to demonstrate the integration of innovative web
development techniques to create a functional and aesthetically appealing
website.
3. Section-Based Navigation
Each section of the website is linked to the navigation menu. As users scroll
through the site, the corresponding navigation link is highlighted, helping them
keep track of their current location on the page.
4. Scroll Animations
To create a visually captivating experience, the website incorporates animations
using the ScrollReveal library. Elements like images, text, and headers
gracefully appear as users scroll, enhancing the overall design.
<html lang="en">
<head>
<meta charset="UTF-8">
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css"
rel="stylesheet">
<title>product Site</title>
</head>
<body>
</a>
<ul class="nav__list">
<li class="nav__item">
</li>
<li class="nav__item">
</li>
<li class="nav__item">
</li>
<li class="nav__item">
</li>
</ul>
<i class="ri-close-line"></i>
</div>
</div>
<i class="ri-function-line"></i>
</div>
</nav>
</header>
<main class="main">
<div>
<img src="img/head.jpg" alt="" class="home__img">
</div>
<div class="home__data">
<div class="home__header">
<h1 class="home__title">Forest</h1>
<h2 class="home__subtitle">Watch</h2>
</div>
<div class="home__footer">
</p>
<span class="button--flex">
</span>
<span class="home__price">1899</span>
</a>
</div>
</div>
</div>
</section>
</div>
</section>
<div class="specs__data">
</div>
<div class="specs__data">
<span class="specs__subtitle">Black</span>
</div>
<div class="specs__data">
</div>
<div class="specs__data">
</div>
</div>
<div>
</div>
</section>
<div>
</div>
<div class="case__data">
</p>
</a>
</div>
</div>
</section>
<!--=============== DISCOUNT ===============-->
<div class="discount__animate">
</a>
</div>
</div>
</section>
</h2>
<article class="products__card">
<div class="products__content">
<img src="img/715J-vDY43L._SX569_.jpg" alt=""
class="products__img">
<h3 class="products__title">White</h3>
<span class="products__price">1899</span>
</button>
</div>
</article>
<article class="products__card">
<div class="products__content">
<h3 class="products__title">Blue</h3>
<span class="products__price">1949</span>
</button>
</div>
</article>
<article class="products__card">
<div class="products__content">
<img src="img/71KjY-0caLL._SX569_.jpg" alt=""
class="products__img">
<span class="products__price">1899</span>
</button>
</div>
</article>
<article class="products__card">
<div class="products__content">
<span class="products__price">1899</span>
</button>
</div>
</article>
<article class="products__card">
<div class="products__content">
<span class="products__price">1899</span>
</button>
</div>
</article>
</div>
</section>
</main>
</a>
<div class="footer__content">
<h3 class="footer__title">Products</h3>
<ul class="footer__links">
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
<div class="footer__content">
<h3 class="footer__title">Support</h3>
<ul class="footer__links">
<li>
</li>
<li>
<li>
</li>
<li>
</li>
</ul>
</div>
<div class="footer__content">
</button>
</form>
<div class="footer__social">
<i class="ri-facebook-fill"></i>
</a>
<i class="ri-instagram-line"></i>
</a>
<a href="" target="_blank" class="footer__social-link">
<i class="ri-twitter-line"></i>
</a>
</div>
</div>
</div>
<p class="footer__copy">
</p>
</footer>
</a>
<script src="https://unpkg.com/scrollreveal"></script>
<script src="./home.js"></script>
</body>
</html>
This HTML code is a complete webpage structure that includes various
sections and elements commonly used in modern web design. Here's a brief
explanation of each part:
1. DOCTYPE Declaration:
html
Copy code
<!DOCTYPE html>
Specifies the document type and version of HTML being used. <!DOCTYPE
html> indicates that the page is using HTML5.
2. <html> Tag:
html
Copy code
<html lang="en">
Defines the root element of the HTML document and specifies the
language used (lang="en" for English).
3. <head> Section:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Product Site</title>
</head>
<meta> tags define character encoding and viewport settings for responsive design.
Favicon link for the browser icon.
Remix Icons stylesheet for icon usage throughout the site.
CSS link to the site's main stylesheet.
<title> defines the title of the webpage.
4. <body> Section:
html
Copy code
<body>
<!-- Header -->
<header class="header" id="header">
...
</header>
Header: Contains the navigation menu, logo, and toggle button for the
menu.
Main: The main content of the page including various sections like
Home, Specs, Case, Discount, and Products.
Footer: Contains links to various product categories, support links,
a subscription form, and social media icons.
Scroll Up Button: A button that allows users to quickly scroll to the top
of the page.
Scripts: External scripts for scroll reveal animations and custom
JavaScript.
6. Footer:
Contains links to different sections (Products, Support), a subscription
form, and social media icons.
<p class="footer copy">: Displays copyright information.
7. Additional Scripts:
Scroll Reveal: For animating elements on scroll.
Custom JavaScript: For interactivity such as adding items to the
shopping bag.
--- CSS CODE ---
html {
scroll-behavior: smooth;
}
body {
margin: var(--header-height) 0 0 0;
font-family: var(--body-font);
font-size: var(--normal-font-size);
background-color: var(--body-color);
color: var(--text-color);
}
h1, h2, h3 {
color: var(--title-color);
}
ul {
list-style: none;
}
a{
text-decoration: none;
}
button,
input {
border: none;
outline: none;
}
button {
cursor: pointer;
}
img {
max-width: 100%;
height: auto;
}
/*=============== REUSABLE CSS CLASSES ===============*/
.section {
padding: 4rem 0 2rem;
}
.section__title {
font-size: var(--bigger-font-size);
text-align: center;
margin-bottom: var(--mb-2-5);
}
.section__title-gradient {
background: var(--text-gradient);
color: transparent;
-webkit-background-clip: text;
background-clip: text;
}
.container {
max-width: 968px;
margin-left: var(--mb-1-5);
margin-right: var(--mb-1-5);
}
.grid {
display: grid;
}
.nav__logo {
display: flex;
width: 1.5rem;
}
.nav__toggle {
font-size: 1.2rem;
color: var(--white-color);
cursor: pointer;
}
.nav__list {
display: flex;
flex-direction: column;
align-items: center;
row-gap: 1rem;
}
.nav__link {
color: var(--white-color);
font-size: var(--h2-font-size);
text-transform: uppercase;
font-weight: var(--font-semi-bold);
background: var(--text-gradient);
color: transparent;
-webkit-background-clip: text;
background-clip: text;
transition: .4s;
}
.nav__link:hover {
background: var(--white-color);
color: transparent;
-webkit-background-clip: text;
background-clip: text;
}
.nav__close {
position: absolute;
font-size: 1.5rem;
top: 1rem;
right: 1rem;
color: var(--white-color);
cursor: pointer;
}
/* show menu */
.show-menu {
top: 0;
}
/* Active link */
.active-link {
background: var(--white-color);
color: transparent;
-webkit-background-clip: text;
background-clip: text;
}
.home__data {
padding-top: 5rem;
}
.home__header {
position: relative;
}
.home__title {
position: absolute;
top: -4rem;
left: 1rem;
line-height: 6rem;
font-size: var(--biggest-font-size);
background: var(--text-gradient);
color: transparent;
-webkit-background-clip: text;
background-clip: text;
}
.home__subtitle {
font-size: var(--big-font-size);
margin-bottom: var(--mb-2-5);
}
.home__title-description {
font-size: var(--h3-font-size);
font-weight: var(--font-medium);
margin-bottom: var(--mb-1);
}
.home__description {
margin-bottom: var(--mb-2-5);
line-height: var(--text-line-height);
}
.home__price {
font-size: var(--h3-font-size);
font-weight: var(--font-semi-bold);
margin-left: var(--mb-0-75);
}
.button:hover {
background-color: var(--black-color-alt);
}
.button__icon {
font-size: 1.2rem;
}
.button--flex {
display: inline-flex;
align-items: center;
column-gap: .75rem;
}
.sponsor__container {
grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
row-gap: 5rem;
justify-items: center;
align-items: center;
}
.specs__content {
row-gap: 1.5rem;
}
.specs__data {
display: grid;
row-gap: .25rem;
}
.specs__icon {
font-size: 1.2rem;
color: var(--white-color);
}
.specs__title {
font-size: var(--normal-font-size);
font-weight: var(--font-medium);
}
.specs__subtitle {
font-size: var(--smaller-font-size);
}
.specs__data:nth-child(1), .specs__data:nth-child(4) {
margin-left: 1.5rem;
}
.specs__img {
width: 250px;
position: absolute;
top: 2rem;
right: -4rem;
}
.case__data {
padding: 5rem 0 3rem;
}
.case__img {
width: 250px;
position: absolute;
left: -7rem;
}
.case__description {
margin-bottom: var(--mb-1-5);
line-height: var(--text-line-height);
}
.discount__title {
font-size: var(--h3-font-size);
margin-bottom: var(--mb-0-75);
}
.discount__description {
margin-bottom: var(--mb-1);
}
.discount__img {
width: 300px;
position: absolute;
top: 4rem;
right: -11rem;
}
.products__container {
grid-template-columns: repeat(2, 1fr);
gap: 5rem 1.5rem;
padding-top: 3rem;
}
.products__card {
position: relative;
height: 132px;
background-color: var(--container-color);
padding: .75rem;
border-radius: .5rem;
display: grid;
}
.products__img {
width: 80px;
position: absolute;
inset: 0;
margin-right: auto;
margin-left: auto;
top: -3rem;
}
.products__content {
align-self: flex-end;
}
.products__title, .products__price {
font-size: var(--small-font-size);
}
.products__price {
font-weight: var(--font-semi-bold);
}
.products__button {
position: absolute;
right: .5rem;
bottom: .5rem;
padding: .5rem;
border-radius: .35rem;
}
.footer__logo {
width: 2rem;
}
.footer__title {
font-size: var(--h3-font-size);
font-weight: var(--font-medium);
margin-bottom: var(--mb-1);
}
.footer__links {
display: flex;
flex-direction: column;
row-gap: .5rem;
}
.footer__link {
color: var(--text-color);
}
.footer__link:hover {
color: var(--white-color);
}
.footer__form {
display: flex;
column-gap: .5rem;
background-color: var(--container-color);
padding: .5rem .75rem;
border-radius: .5rem;
margin-bottom: var(--mb-2);
}
.footer__input {
background-color: var(--container-color);
width: 90%;
color: var(--white-color);
}
.footer__input::placeholder {
color: var(--text-color);
font-size: var(--normal-font-size);
font-family: var(--body-font);
}
.footer__social {
display: flex;
column-gap: 1.25rem;
}
.footer__social-link {
display: inline-flex;
color: var(--white-color);
background-color: var(--container-color);
padding: .5rem;
border-radius: .25rem;
font-size: 1rem;
}
.footer__social-link:hover {
background-color: var(--black-color);
}
.footer__copy {
margin-top: 5rem;
text-align: center;
}
.footer__copy-link {
font-size: var(--smaller-font-size);
color: var(--text-color-light);
}
.scrollup__icon {
color: var(--white-color);
font-size: 1.35rem;
}
::-webkit-scrollbar-thumb {
background-color: var(--scroll-thumb-color);
border-radius: .5rem;
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--scroll-thumb-color-alt);
}
1. Google Fonts
The @import rule loads the "Poppins" font family from Google Fonts
in different font weights (400, 500, 600).
3. Media Queries
Breakpoints:
o Adjust styles for different screen sizes.
o Increase font sizes and padding for larger devices, while
optimizing layouts for smaller screens.
4. Base Styles
Reset defaults (padding, margin) and set global styles:
o * { box-sizing: border-box; } ensures
padding doesn’t affect element dimensions.
o body uses custom colors and fonts with smooth
scrolling (scroll-behavior).
o Links, buttons, and inputs are styled with no default decorations.
6. Layout
.main ensures overflow content is hidden.
.container centers and limits content width for readability.
.grid applies grid layout, crucial for responsive designs.
7. Header
Fixed header (position: fixed) at the top of the page.
Adjusts background dynamically based on scroll (.scroll-header).
8. Navigation
.nav flexibly arranges the logo, toggle button, and menu.
Includes styles for hover effects and animations to show/hide menus.
Responsive design ensures the menu adapts to mobile screens.
9. Home Section
.home img positions an image creatively using absolute positioning.
.home title and .home subtitle style headings
with gradients for impact.
10. Buttons
.button uses rounded corners, padding, and hover effects
for interactivity.
13. Footer
Grid layout organizes links, forms, and social media icons.
.footer form styles subscription forms for a clean and
minimalistic look.
15. Scrollbar
Customizes the scrollbar for better aesthetics with ::-webkit-
scrollbar.
16. Media Queries
Tailor layouts for:
o Small Devices (<340px): Adjust grid columns, reduce image sizes.
o Medium Devices (576px+): Rearrange grids, ensure better
spacing.
o Large Devices (1024px+): Increase margins, improve spacing and
image sizes.
--- JAVA CODE ---
function linkAction(){
const navMenu = document.getElementById('nav-menu')
// When we click on each nav__link, we remove the show-menu class
navMenu.classList.remove('show-menu')
}
navLink.forEach(n => n.addEventListener('click', linkAction))
function scrollActive(){
const scrollY = window.pageYOffset
sections.forEach(current =>{
const sectionHeight = current.offsetHeight
const sectionTop = current.offsetTop - 50;
sectionId = current.getAttribute('id')
1. SHOW MENU
Variables:
o navMenu: Refers to the navigation menu.
o navToggle: Button or element used to open the menu.
o navClose: Button or element used to close the menu.
Functionality:
o Adds a click event listener to navToggle. When clicked,
the show-menu class is added to the navMenu, making it
visible.
o Adds a click event listener to navClose. When clicked,
the show-menu class is removed, hiding the menu.
4. SHOW SCROLL UP
Functionality:
o Detects when the scroll exceeds 200px.
o Adds the show-scroll class to an element (e.g., a scroll-to-
top button) to make it visible.
o Removes the show-scroll class when scrolling above 200px.
Key Features:
1. Navigation menu:
o Toggles visibility using classes.
o Automatically hides on link click (for better UX on mobile).
2. Dynamic header:
o Changes appearance when scrolling for improved design and
clarity.
3. Scroll-to-top button:
o Appears when the user scrolls down for easy navigation.
4. Active section highlighting:
o Helps users know which section they are viewing by highlighting
the corresponding navigation link.
5. Scroll animations:
o Adds a modern, visually appealing animation effect as elements
enter the viewport.
This script improves interactivity, navigation, and design for the webpage,
making it user-friendly and visually engaging.