Watch Shop Website Using HTML CSS & JS With Source Code
Introduction
Welcome to the digital forefront of innovation with our newly crafted website for the Honor Element Series Smartwatch. This sleek, modern site was built using the power trio for web development: HTML, CSS, and JavaScript. Let us delve into what makes this website not only visually appealing but highly functional as well.
It is in HTML that the backbone of our website is located. This gives a robust structure to the content and organizes it effectively. HTML forms the base, which guarantees that everything, from the navigation menu to product description, images, and links, are well laid out in their proper positions. CSS brings our website alive with style and elegance. Beautifully crafted stylesheets add grace to the site by providing smooth layouts, engaging color schemes, and responsive designs. JavaScript embeds interactivity and dynamism in our website. From responsive navigation menus to interactive product displays, JavaScript ensures smoothness and engagement in user experience.
By using HTML, CSS, and JavaScript together, the Honor Element Series Smartwatch has been developed into a quite complete and extremely engaging digital experience. This site not only means to express the grace and novelty of the product but will also make sure users experience the smoothness and pleasure of browsing.
index.html
This HTML template constructs a modern web page, including the most significant sections. At the very top is the head section with meta tags for setup: character set, settings for its viewport and browser compatibility, page title, links to some external resources: CSS stylesheet for styling, Boxicons for iconography, and Google Fonts for custom typography.
The header section introduces a logo, navigation bar links to sections such as Home, About, Smartphone, Store, Contact Us, and interactive elements like the “Buy Now” button, menu icon, and dark mode toggle.
The hero section engages the user with its bold headline, sub-headline, and a minute promotional paragraph regarding smartwatches. This section contains the highlighting of products, mentioning their variants with the names, descriptions, and respective images. All this makes this section very engaging and interactive, influencing users to click on the products to view them further.
An arrow icon below the hero section would, therefore, encourage users to scroll down for more content, hence indicating the availability of more information. At the very end, this template links to some external JavaScript files that add interactivity and functionality, which in turn provide things like animations and other dynamic elements to enhance the user experience.
This HTML template balances appeal with functionality, maintaining a well-structured layout—the perfect setup for any modern responsive page. It provides a sound framework on top of which a truly interactive and engaging user interface can be built.
honor
Honor
Smartwacth
Element series
Stay connected and in control with just a flick of your wrist - all thanks to the power of a smartwatch.
Gold
Element
White
Element
Black
Element
styles.css
This is the CSS code that goes to the styling of a web page and puts much emphasis on a beautiful, responsive layout. It begins with a universal reset, which removes the default margins and padding, list styles, and applies a font with border-box sizing to all elements. The root variables declare the centralization of colors, font sizes, and other design constants for the management of the theme.
It styles the body with a background color and text color inherited from the root variables. The header is positioned fixed at the top, and it’s full-width and uses flexbox to center its content. Interactions are going to transition smoothly. The logo has a large, bold font and an icon with a striking color.
Navigation links are styled for visual consistency with interactive feedback of color change on their hover and active states. The setup for the hero area is prepared with a grid to lay out the content responsively with large images and text elements, adjusting accordingly to screen size. Text in the hero section is styled for emphasis; it has large bold headlines, smaller subheadings, and descriptive paragraphs that support them.
It adds dedicated styles to the background color, padding, and hover effects of buttons and icons respectively to make them interactive. Padding, shadowing, and transitions are added to several sections and elements, such as boxes and down-arrow icons, detail them out.
It makes use of media queries to change the layout on different screen sizes using padding, font size, image dimensions, and grid layout. The navigation menu changes to a vertical list on small screens. This would improve the mobile user experience. Further styles are added for dark mode, where it changes background and text colors so that the user has the exact same experience on themes.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "MuseoModerno", cursive;
list-style: none;
text-decoration: none;
}
:root {
--text-color: #000000;
--bg-color: #e5e5e5;
--main-color: #f29494;
--secound-color: #fff;
--big-font: 5.5rem;
--other-color: #868686
--p-font: 1rem;
}
body {
background: var(--bg-color);
color: var(--text-color);
}
header {
position: fixed;
top: 0;
right: 0;
z-index: 1000;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 27px 9%;
transition: all ease .55s;
}
.logo{
display: flex;
color: var(--text-color);
font-size: 40px;
align-items: center;
font-weight: bold;
}
.logo i{
vertical-align: middle;
font-size: 35px;
color: var(--main-color);
margin-right:5px ;
}
.navlist{
display: flex;
}
.navlist a{
font-size: var(--p-font);
color: var(--text-color);
font-weight:600 ;
margin: 0 35px;
transition: all ease .55s;
}
.navlist a:hover{
color: var(--main-color);
}
.navlist a:active{
color: var(--main-color);
}
.h-main{
display: flex;
align-items: center;
}
.h-btn{
background: var(--main-color);
display: inline-block;
padding: 10 25px;
font-size: 14px;
color: var(--bg-color);
font-weight: 500;
border-radius: 5px;
border: 2px solid var(--main-color);
margin-right: 20px;
transition: all ease .55s;
}
.h-btn:hover{
background: transparent;
border: 2px solid black;
color: var(--text-color);
}
#menu-icon{
font-size: 40px;
color: var(--text-color);
z-index: 10001;
cursor: pointer;
display:none ;
}
#darkmode{
font-size:30px;
cursor: pointer;
color: var(--text-color);
margin-left: 10px;
}
section{
padding: 0 12%;
}
.hero{
width: 100%;
height: 100vh;
display: grid;
gap: 1rem;
grid-template-columns:repeat(2, 1fr) ;
align-items: center;
}
.hero-img{
width: 800px;
height: 800px;
}
.hero-img img{
width: 100%;
height: 100%;
object-fit: contain ;
/* 21:57 */
}
.hero-in{
display: grid;
grid-template-columns: repeat(auto-fit,minmax(100px, auto));
align-items: center;
text-align: center;
gap: 30px;
}
.hero-text h1{
line-height: 1.3;
font-weight: 800;
font-size: var(--big-font);
}
.hero-text h4{
margin:0 10px 25px ;
font-weight: 400;
font-size: 22px;
color: var(--main-color);
text-transform: uppercase;
letter-spacing: 10px;
}
.hero-text p{
color: var(--other-color);
font-size: var(--p-font);
font-weight: 500;
line-height: 26px;
max-width: 550px;
margin-bottom: 5rem;
}
.box{
background: var(--secound-color);
padding: 25px 40px;
box-shadow: rgba(33,35,38,0.1) 0px 10px 10px -10px;
transition: all ease .55s;
border-radius: 1rem;
}
.box img{
height: auto;
max-width: 100%;
}
.box h3{
font-size: 30px;
font-weight: 700;
margin-bottom:7px ;
}
.box h5{
color: var(--main-color);
font-size: 15px;
letter-spacing: 4px;
font-weight: 400;
}
.box:hover{
transform: translateY(-5px) scale(1.1);
}
.down-arrow{
position: absolute;
bottom: 3.5rem;
right: 9%;
}
.down-arrow i{
padding:14px ;
color: var(--bg-color);
transition: all ease .55s;
font-size: 25px;
border-radius: 3rem;
cursor: pointer;
background:var(--text-color);
}
.down-arrow i:hover{
background: var(--main-color);
transform: translateY(5px);
}
body.color{
--text-color:#000;
--bg-color:#08162a;
--secound-color:#2b3544;
}
@media (max-width: 1600px){
header{
padding: 13px 3%;
}
section{
padding: 0 5%;
}
}
@media (max-width: 1470px){
.hero-img{
height: 700px;
width: 700px;
}
}
@media (max-width: 1400px){
:root{
--big-font: 4rem;
--p-font: 15px;
}
.box h3{
font-size: 20px;
margin-bottom: 2px;
}
.hero-img{
width: 600px ;
height: 600px;
}
}
@media (max-width: 1230px){
.hero{
grid-template-columns: 1fr;
height: auto;
}
.hero-text{
order: 2;
}
section{padding: 50px 5%;}
.hero-img{
margin: auto;
height: auto;
width: auto;
}
.hero-img img{
width: 100%;
height: auto;
max-width: 650px;
}
.down-arrow{display: none;}
}
@media (max-width: 1070px){
header{
padding: 10px 3%;
background: var(--secound-color);
}
#menu-icon{
display: initial;
}
.navlist{
position: absolute;
top: -700px;
left: 0;
right: 0;
display: flex;
flex-direction:column ;
background: #000;
transition: all ease .55s;
text-align: left;
}
.navlist a{
display: block;
font-size: 23px;
font-weight: 400;
margin: 0.8rem 1.8rem;
color:var(--secound-color) ;
}
.navlist.open{
top: 100%;
}
}
@media (max-width:600px) {
.hero-in{
grid-template-columns: repeat(auto-fit,minmax(190px, auto));
gap: 18px;
}
.box{padding: 10px 30px;}
.h-btn{
padding: 6px 14px;
margin-right: 8px;
}
:root{
--big-font:4rem;
--p-font: 15px;
}
.logo{
font-size:32px;
}
#menu-icon{
margin-right:5px ;
}
}
script.js
This is a JavaScript code that will handle the toggling for dark mode, opening and closing a nav menu, and does the reveal animations on elements within the webpage.
First is the selection of the dark mode toggle button. Later, it attaches an event listener to the button. Every time the button is clicked, it checks whether the button currently has a certain class. If so, it toggles an icon to a sun and applies a class to the body element to toggle into dark mode. If it is currently a sun, it toggles back to the moon icon and removes the dark mode class from the body, toggling back to light mode.
The second part selects the menu icon and the navigation list. A click event listener is added to the menu icon to toggle its class and the class of the navigation list. This will open or close the navigation menu; this is part of responsive design, for smaller screens where the menu needs to be toggled.
The last part initializes ScrollReveal, a library used to create scroll animations. It just simply sets up the animation parameters—distance, duration, whether it should reset—and then applies the reveal animations to specific elements on a page to make them appear with a delay and from different directions as scrolling down the page. The animations would add a dynamic visual effect, animating the hero text, hero image, and hero arrow when they come into view.
const darkmode = document.querySelector('#darkmode');
darkmode.onclick = () => {
if(darkmode.classList.contains('bx-moon')){
darkmode.classList.replace('bx-moon', 'bx-sun');
document.body.classList.add('color');
}else{
darkmode.classList.replace('bx-sun','bx-moon');
document.body.classList.remove('color');
}
};
let menu = document.querySelector('#menu-icon');
let navlist = document.querySelector('.navlist');
menu.onclick = () => {
menu.classList.toggle('bx-x');
navlist.classList.toggle('open');
}
const sr = scrollReveal ({
distance: '70px',
duration: 2700,
reset: true
});
sr.reveal('.hero-text',{delay:200, origin: 'bottom'});
sr.reveal('.hero-img',{delay:350, origin: 'top'});
sr.reveal('.hero-arrow',{delay:400, origin: 'right'});