< BACK TO COMPONENTS

Create a Responsive Furniture Website: HTML, CSS, JavaScript Guide

Faraz

By Faraz -

Learn how to build a stunning furniture website with HTML, CSS, and JavaScript. Perfect for beginners and includes downloadable source code.


Create a Responsive Furniture Website HTML, CSS, JavaScript Guide.webp

In today's digital age, having a responsive website is more important than ever, especially for businesses like furniture stores looking to attract and engage customers online. A responsive website adapts seamlessly to various screen sizes and devices, providing users with an optimal viewing and browsing experience.


In this comprehensive guide, we'll walk you through the process of creating a responsive furniture website using HTML, CSS, and JavaScript. Whether you're a beginner or an experienced developer, you'll find valuable insights and practical tips to help you build a stunning online presence for your furniture business.


From setting up your project and structuring HTML to styling with CSS and adding interactivity with JavaScript, we'll cover every step of the way. By the end of this tutorial, you'll not only have a fully functional furniture website but also a deeper understanding of responsive web design principles that you can apply to future projects.


So, let's dive in and start coding your responsive furniture website today!

Source Code

Step 1 (HTML Code):

The first thing we need to do is create our HTML File for the furniture website. We'll start with well-organized markup. After creating the files just paste the following codes into your file. Remember that you must save a file with the .html extension.


Let's break down the key components and their functions:


Document Type Declaration (<!DOCTYPE html>):


  • Declares the document type and version of HTML being used.

HTML Structure:


  • <html>: The root element of the HTML document.
  • lang="en": Specifies the language of the document as English.

Head Section (<head>):


  • Contains metadata and links to external resources.
  • Meta Tags: Provide metadata about the HTML document, such as character set, viewport settings, etc.
  • Title: Sets the title of the webpage.
  • External Stylesheets and Scripts: Links to external CSS stylesheets and JavaScript files.
  • Font Imports: Imports external fonts from Google Fonts.

Body Section (<body>):


  • Contains the visible content of the webpage.

Navigation Bar (<nav>):


  • Provides navigation links for the website.
  • Includes a logo and a navigation menu (which can be toggled with JavaScript).

Menu Section (<menu>):


  • Contains contact details and additional links.
  • Uses icons from Font Awesome and Iconify for visual representation.

Header Section (<header>):


  • Represents the header of the webpage.
  • Includes a prominent title, a brief description, and a call-to-action button.

Main Content Section (<main>):


  • Contains the main content of the webpage.
  • Divided into several divisions (<div>):
  • Division 1 (<div class="divisions division_1">): Displays an image and accompanying text about interior design.
  • Division 2 (<div class="divisions division_2">): Displays images and descriptions of different furniture products/services.
  • Division 3 (<div class="divisions division_3">): Highlights recycling efforts and encourages contact.

Footer Section (<footer>):


  • Contains links to social media, additional pages, and copyright information.

Additional Elements:


  • An empty <div> with the class "additional".
  • A "roll back" button (<a> with id "roll_back") for scrolling back to the top of the page.

Scripts:


  • Links to external JavaScript files for dynamic behavior and interactivity.

Step 2 (CSS Code):

Next, we need to style our furniture website page by adding our CSS. This will give our furniture website an upgraded presentation. Create a CSS file with the name of styles.css and paste the given codes into your CSS file. Remember that you must create a file with the .css extension.


Let's break down the CSS code:


Global Styles:


  • scroll-behavior: smooth;: This makes scrolling behavior smooth throughout the webpage.
  • box-sizing: This ensures that padding and border are included in the element's total width and height.

Color Variables:


  • Defines various color variables using CSS custom properties (variables).

Scrollbar Styles:


  • Styles for customizing the appearance of scrollbars on web pages.

Body Styles:


  • Resets margin and sets the default font family for the body.

Link Styles:


  • Removes default underlines from links and sets their text color.

Text Styles:


  • Sets styles for various text elements like paragraphs (p), headings (h1 to h6), and emphasized text (em).

Button Styles:


  • Defines styles for buttons, including padding, border radius, colors, and hover effects.

Layout and Flexbox Styles:


  • Sets up styles for flexbox layouts and grids.
  • Defines padding classes for different sizes.
  • Sets font sizes for different elements.

Media Queries:


  • Adjusts styles for smaller screens (max-width: 920px).
  • Changes font sizes and padding for better responsiveness.

Navigation Styles:


  • Sets styles for a fixed navigation bar at the top of the page.
  • Defines padding, alignment, colors, and transitions.

Hamburger Menu Icon Styles:


  • Defines styles for a hamburger menu icon (ham class), including its width, height, position, and color.
  • Creates two pseudo-elements (before and after) to form the hamburger lines.
  • Adds transitions for smooth hover effects.
  • Rotates the pseudo-elements to create the open and close animation.

Navigation Menu Styles:


  • Defines styles for a fixed navigation menu (menu element), including its position, width, height, background color, and transition effects.
  • Sets styles for menu items (menu a) and dropdowns (menu .dropdown) such as color, padding, and hover effects.
  • Defines dropdown content to be hidden by default (menu .dropdown_content).

Footer Styles:


  • Defines styles for the footer section, including its width, background color, alignment, and text color.
  • Sets styles for footer links (footer a) and paragraphs (footer p).
  • Adjusts styles for responsiveness on smaller screens using media queries.

Additional Content Styles:


  • Defines styles for additional content displayed on the page (additional class), including its position, alignment, and maximum width.
  • Sets styles for alerts (alert class), including background color, border, border radius, box shadow, and icon size.

Overlay and Roll Back Button Styles:


  • Defines styles for an overlay (overlay class) that covers the entire screen.
  • Sets styles for a roll back button (#roll_back ID), including its position, background color, border, padding, display, and alignment.

Header Styles:


  • Defines styles for the header section, including its width, background image (with linear gradient), background size, position, and text color.
  • Sets styles for header content (header article), including padding and text color.

Header Media Query:


  • When the viewport width is less than or equal to 920px:
  • Adjusts the background size and position of the header to maintain responsiveness.
  • Reduces the padding of the header article to optimize space.

Division 1 Styles:


  • Sets background color and text color for division 1.
  • Defines styles for the figure within division 1, including the image and a pseudo-element before the image for decoration.
  • Styles paragraphs (p) within division 1 articles.
  • Styles the aside element within division 1, particularly setting margins and borders for child elements.
  • Within the media query for a viewport width less than or equal to 920px:
  • Reduces the width of the image within the figure.
  • Adjusts the size and position of the pseudo-element.
  • Reduces the margin-top for the aside element.

Division 2 Styles:


  • Styles division 2 elements, including flex content, figures, images, and captions.
  • Sets maximum heights for images within cards.
  • Styles card layouts within division 2.
  • Defines styles for even and odd child elements of cards.
  • Within media queries for various viewport widths:
  • Reduces the maximum height of images for smaller screens.
  • Adjusts layouts and visibility of elements for different screen sizes.

Division 3 Styles:


  • Styles division 3 elements, setting background color, border radius, and box shadow for sections.
  • Defines styles for figures and images within division 3.
  • Sets styles for buttons.
  • Within media queries for smaller viewport widths:
  • Adjusts the width of figures for better fit on smaller screens.
*, html{
  scroll-behavior: smooth;
}

*, *:after, *:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

:root{
  --white:#FFF;
  --black:#000;
  --lite:rgba(255,255,255,0.6);
  --gray:rgba(1,1,1,0.6);
  --dark:#1e1e1d;
  --primary:#d6863a;
  --primary_dark:#93683f;
  --primary_lite:#ebab61;
  --default_font:'Nunito Sans', sans-serif;
}

::-webkit-scrollbar {
  height: 12px;
  width: 4px;
  background: var(--dark);
}

::-webkit-scrollbar-thumb {
  background: gray;
  -webkit-box-shadow: 0px 1px 2px var(--dark);
}

::-webkit-scrollbar-corner {
  background: var(--dark);
}

body{
  margin:0;
  overflow-x:hidden !important;
  font-family: var(--default_font);
}

a{
  text-decoration:none !important;
  min-width: fit-content;
  width: fit-content;
  width: -webkit-fit-content;
  width: -moz-fit-content;
}

a, button{
  transition:0.5s;
}

em{
  font-style:normal;
  color:var(--primary_dark);
}

figure{
  padding:0;
  margin:0;
}

a, p, .btn{
  font-size:15px;
}

p{
  line-height:1.9em;
  color:var(--gray);
}

a, button, input, textarea, select{
  outline:none !important;
}

fieldset{
  border:0;
}

h1, h2, h3, h4, h5, h6{
  margin:0;
}

.title, .sub_title{
  font-family:var(--title_font);
  font-weight:800;
  margin:0;
}

.flex, .fixed_flex{
  display:flex;
}

.flex_content{
  width:100%;
  position:relative;
}

.grid{
  display:grid;
}

.padding_1x{
  padding:1rem;
}

.padding_2x{
  padding:2rem;
}

.padding_3x{
  padding:3rem;
}

.padding_4x{
  padding:4rem;
}

.big{
  font-size:3.5em;
}

.medium{
  font-size:2em;
}

.small{
  font-size:1.3em;
}

.btn{
  padding:0.6rem 1rem;
  border-radius:5px;
  position:relative;
  border:0;
  text-align:center;
}

.btn_1{
  background:var(--primary);
  color:var(--white);
}

.btn_1:hover{
  opacity:0.8;
}

.btn_2{
  background-color:var(--white);
  color:var(--dark);
}

.btn_2:hover{
  box-shadow: rgb(1, 1, 1) 3px 3px 6px 0px inset, rgba(1, 1, 1, 0.5) -3px -3px 6px 1px inset;
  color:var(--dark);
}

.btn_3{
  display:block;
  background-color:0;
  color:var(--white);
  position:relative;
  font-family:var(--default_font);
  font-weight:400;
  text-transform:uppercase;
}

.btn_3:before{
  content:"";
  border-radius:50%;
  background-color:rgba(255,255,255,0.2);
  position:absolute;
  left:0;
  top:50%;
  width:40px;
  height:40px;
  transition:0.5s;
  transform:translate(0%, -50%);
}

.btn_3:after{
  content:"\f178";
  font-family:"FontAwesome";
  margin-left:5px;
}

.btn_3:hover:before{
  border-radius:40px;
  width:100%;
}

.divisions{
  position:relative;
}

.title_header{
  margin:auto;
  text-align:center;
  width:60%;
}

.ball:before{
  content:"";
  border-radius:50%;
  background-color:rgba(1,1,1,0.2);
  position:absolute;
  left:0;
  top:50%;
  width:30px;
  height:30px;  
  transform:translate(-50%, -50%);
}

.link-tag{
  position:relative;
}

.link-tag:before{
  content:"\f0da";
  font-family:"FontAwesome";
  margin-right:5px;
  transition:0.5s;
  color:var(--primary_dark);
}

.link-tag:hover:before{
  margin-right:10px;
  color:var(--black);
}

.link-tag:hover{
  color:var(--primary_dark);
}

@media (max-width:920px){
  .flex{
      flex-wrap:wrap;
  }
  
  .padding_1x, .padding_2x, .padding_3x, .padding_4x{
      padding:1rem;
  }
  
  .big{
      font-size:1.8em;
  }
  
  .medium{
      font-size:1.6em;
  }
  
  .small{
      font-size:1.1em;
  }
  
  .btn{
      padding:0.5rem 1rem;
  }
  
  a, p, .btn{
      font-size:12px;
  }
  
  .title_header{
      width:100%;
  }
}


nav{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  padding:1rem 2rem;
  align-items:center;
  justify-content:space-between;
  color:var(--white);
  background-color:transparent;
  z-index:999;
  transition:0.5s;
}

nav a{    
  color:var(--lite);
}

nav figure{
  width:200px;
  font-weight:800;
  font-size:1.5em;
}

.ham{
  width:30px;
  height:15px;
  position:relative;
  color:var(--lite);
  z-index:11 !important;
}

.ham:before, .ham:after{
  content:"";
  position:absolute;
  left:0;
  height:3px;
  background-color:var(--white);
  border-radius:40px;
  z-index:1;
  transition:0.5s;
}

.ham:before{
  top:0;
  width:50%;
}

.ham:after{
  bottom:0;
  width:100%;
}

.ham:hover:before, .ham:hover:after{
  background-color:var(--white);
}

.hamburger:before{
  width:100%;
  transform:rotate(50deg);
  top:6px;
}

.hamburger:after{
  transform:rotate(-50deg);
  bottom:6px;
}

@media (max-width:920px){
  nav{
      padding:1rem;
  }
  
  nav figure{
      font-size:1.1em;
  }
}


menu{
  position:fixed;
  left:-105%;
  top:0;
  z-index:99;
  background-color:var(--dark);
  width:350px;
  height:100%;
  margin:0;
  padding:0;
  overflow-x:hidden;
  overflow-y:auto;
  transition:0.5s;
}

menu figure{
  width:250px;
  font-size:2em;
  color:var(--white);
}

menu .details{
  padding-top:6rem;
}

menu .details a{
  display:flex;
  align-items:center;
  font-size:12px;
}

menu .details a iconify-icon{
  margin-right:10px;
}

menu a, menu .dropdown{
  color:var(--lite);
  display:block;
  padding:0.5rem 0;
  cursor:pointer;
  transition:0.5s;
}

menu .dropdown{
  display:inline-block;
}

menu a:hover, menu .dropdown:hover{
  color:var(--white);
}

menu .dropdown_content{
  display:none;
}

menu .links a:before, menu .links .dropdown dt:before{
  font-family:"FontAwesome";
  margin-right:5px;
  transition:0.5s;
}

menu .links a:before{
  content:"\f0da";
}

menu .links .dropdown dt:before{
  content:"\f0da";
}

menu .links .dropdown dt:hover:before, menu .links a:hover:before{
  margin-right:10px;
}

menu .links .dropdown_content a:before{
  content:"\f105";
}

@media (max-width:920px){
  menu{
      width:100%;
  }
}


footer{
  width:100%;
  background-color:var(--dark);
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  text-align:center;
}

footer section{
  flex:1 1 100%;
}

footer a, footer p{
  color:var(--lite);
}

footer .flex_content:first-child a:not(:last-child){
  margin-right:20px;
}

footer .flex_content a:not(:last-child){
  margin-right:50px;
}

footer .flex_content a .fa{
  font-size:1.6em;
}

footer .flex_content a:hover{
  color:var(--white);
}

@media (max-width:920px){
  footer{
      padding-top:2rem;
  }
  
  footer section{
      padding:0rem 1rem !important;
      text-align:left;
  }

  footer .flex_content:not(:first-child) a{
      margin-right:0px;
      margin:1rem 0;
      display:block;
  }
}

.additional{
  flex-wrap:wrap;
  position:fixed;
  bottom:1rem;
  right:1rem;
  z-index:999;
  max-width:400px;
}

.additional section{   
  flex:1 1 100%;
  position:relative;
}

.alert{
  background-color:var(--dark);
  border:1px solid var(--lite);
  border-radius:10px;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

.alert .close{
  position:absolute;
  color:var(--lite);
  right:0.5rem;
  top:0.5rem;
}

.alert .close:hover{
  color:var(--white);
}

.alert iconify-icon{
  font-size:2em;
  margin-right:20px;
}

.alert iconify-icon[icon="subway:error"]{
  color:red;
}

.alert iconify-icon[icon="bx:error"]{
  color:#d3a120;
}

.alert .title{
  color:var(--white);
}

.alert p{
  color:var(--lite);
}

@Media (max-width:520px){
  .additional{
      max-width:100%;
      width:100%;
      left:50%;
      transform:translate(-50%, 0);
      padding:1rem;
  }
}

.overlay{
  position:fixed;
  top:0;
  left:0;
  z-index:1;
  background-color:var(--gray);
  width:100%;
  height:100%;
}

#roll_back{
  position:fixed;
  bottom:2rem;
  right:2rem;
  background-color:var(--dark);
  border-radius:5px;
  border:2px solid var(--primary);
  padding:5px 10px;
  display:none;
  align-items:center;
  justify-content:center;
  z-index:11;
  box-shadow:0px 6px 16px -6px rgba(1,1,1,0.5);
  color:var(--white);
  font-weight:900;
}


header{
  width:100%;
  background:linear-gradient(to right, var(--black) 10%, var(--gray) 50%, rgba(1,1,1,0.1) 100%), url("https://i.postimg.cc/pdJnpSFp/header.jpg");
  background-size:cover;
  background-position:bottom;
  color:var(--white);
}

header article{
  width:min(100%, 700px);
  padding:10rem 2rem;
}

header article p{
  color:var(--lite);
}

header article em{
  color:var(--primary_lite);
}

@media (max-width:920px){
  header{
      background-size:cover;
      background-position:bottom;
  }
  
  header article{
      padding:7rem 1rem;
  }
}


.division_1{
  background-color:var(--dark);
  color:var(--white);
}

.division_1 figure{
  width:100%;
  position:relative;
  margin:auto;
}

.division_1 figure img{
  width:100%;
  position:relative;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
  border-radius:10px;
}

.division_1 figure:before{
  content:"";
  width:90%;
  height:90%;
  position:absolute;
  left:-20px;
  top:-20px;
  background-color:var(--primary);
  border-radius:10px;
}

.division_1 article p{
  color:var(--lite);
}

.division_1 aside{
  align-items:center;
  margin-top:3rem;
}

.division_1 aside span{
  padding-right:50px;
  color:var(--white);
}

.division_1 aside span:not(:first-child){
  padding-left:50px;
}

.division_1 aside span:not(:last-child){
  border-right:1px solid rgba(255,255,255,0.1);
}


@media (max-width:920px){
  .division_1 figure img{
      width:35%;
  }
  
  .division_1 figure:before{
      width:30%;
      height:95%;
  }
  
  .division_1 aside{
      margin-top:2rem;
  }
}

@media (max-width:520px){
  .division_1 figure img{
      width:100%;
  }
  
  .division_1 figure:before{
      width:90%;
      height:90%;
      top:-10px;
      left:-10px;
  }
  
  .division_1 aside span{
      padding-right:20px;
  }
  
  .division_1 aside span:not(:first-child){
      padding-left:20px;
  }
}


.division_2 .flex_content:first-child{
  width:60%;
  text-align:center;
}

.division_2 figure{
  width:100%;
  position:relative;
  overflow:hidden;
}

.division_2 figure img{
  width:100%;
  object-fit:cover;
}

.division_2 .flex_content:first-child figure, .division_2 .flex_content:first-child figure img{
  height:100%;
}

.division_2 .flex_content:first-child figure figcaption{
  width:90%;
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  background-color:var(--white);
  color:var(--dark);
  z-index:1;
}

.division_2 .cards{
  flex-wrap:wrap;
}

.division_2 .cards .card{
  flex:1 1 100%;
  color:var(--dark);
}

.division_2 .cards .card img{
  max-height:50vh;
}

.division_2 .cards .card img, .division_2 .cards .card figcaption{
  flex:1 1 50%;
}

.division_2 .cards .card:nth-child(even){
  text-align:right;
}

@media (max-width:1420px){
  .division_2 .cards .card img{
      max-height:30vh;
  }
}

@media (max-width:1180px){
  .division_2{
      flex-wrap:wrap;
  }
  
  .division_2 .flex_content:first-child{
      width:100%;
  }
  
  .division_2 .flex_content:first-child figure img{
      display:none;
  }
  
  .division_2 .flex_content:first-child figure figcaption{
      position:relative;
      width:100%;
  }
  
  .division_2 .cards .card img{
      max-height:50vh;
  }
}
  

@media (max-width:520px){
  .division_2, .division_1{
      padding:0 !important;
  }
  
  .division_2 .cards .card{
      display:block;
      border-radius:10px;
      overflow:hidden;
  }
  
  .division_2 .cards .card:not(:last-child){
      margin-bottom:1rem;
  }
  
  .division_2 .cards .card img{
      max-height:100%;
      border-radius:10px;
  }
  
  .division_2 .cards .card figcaption{
      position:absolute;
      background-color:var(--white);
      left:50%;
      width:90%;
      border-radius:10px;
      bottom:1rem;
      transform:translate(-50%, 0%);
      text-align:center;
  }
  
  .division_2 .cards .card:nth-child(even){
      text-align:center;
  }
  
}

.division_3 section{
  width:100%;
  border-radius:10px;
  background-color:#fef8e8;
  margin:auto;
  justify-content:space-between;
  box-shadow: rgba(1, 1, 1, 0.2) 3px 3px 6px 0px inset, rgba(1, 1, 1, 0.2) -3px -3px 6px 1px inset;
}

.division_3 figure{
  width:200px;
  margin-right:20px;
}

.division_3 figure img{
  width:100%;
  height:100%;
}

.division_3 .btn{
  display:block;
}

@media (max-width:1020px){
  .division_3 figure{
      width:100px;
  }
}

@media (max-width:520px){
  .division_3 figure{
      width:80px;
  }
} 

Step 3 (JavaScript Code):

Finally, we need to create a function in JavaScript.


Let's break it down step by step:


Checking if the User is on a Mobile Device:


It first checks if the user is accessing the site from a mobile device by testing the navigator.userAgent string against a regular expression that matches common mobile device names like iPhone, iPad, iPod, and Android.


Dropdown Functionality:


  • It sets up a click event handler for the dt elements inside elements with the class dropdown. When a user clicks on a dt element, it toggles the visibility of the next element with the class dropdown_content with a slow animation.

Handling Click Events on Menu Links:


  • If the user is on a mobile device (isMobile is true), clicking on links inside elements with the class details within the menu has special behaviors:
  • If the clicked link is the first one (index() == 0), it changes its href attribute to initiate a phone call.
  • If the clicked link is the fourth one (index() == 3), it triggers a popup function with a specific message.

Handling Click Events on Menu Links for Non-Mobile Devices:


  • If the user is not on a mobile device, clicking on links inside elements with the class details within the menu has different behaviors:
  • If the clicked link is the first one (index() == 0), it triggers a popup function with a message indicating that calling is not supported on the device.
  • If the clicked link is the fourth one (index() == 3), it triggers a popup function with a specific message.

Popup Function:


  • This function is responsible for displaying popup messages on the webpage. It checks the type of message to display, limits the number of simultaneous alerts, and automatically removes alerts after a certain time.

Handling Hamburger Menu Click:


  • It sets up a click event handler for elements with the class ham (probably representing a hamburger menu icon). When clicked, it checks if the menu is already opened and then adjusts its visibility accordingly, along with adding an overlay to the page to prevent interaction outside the menu.

Handling Close Button Click:


  • It sets up a click event handler for elements with the class close. When clicked, it removes the overlay and closes the menu if it's open.

Function for Closing Overlays and Menu:


  • It's a utility function used to close overlays and the menu. It can take different parameters to specify the type of element to close.

Handling Page Scroll:


  • It sets up a scroll event handler that changes the appearance of the navigation bar (nav) and the visibility of a "roll back" button based on the scroll position.

Create a JavaScript file with the name script.js and paste the given codes into your JavaScript file and make sure it's linked properly to your HTML document so that the scripts are executed on the page. Remember, you’ve to create a file with .js extension.

const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
var count = 0;

$(".dropdown dt").click(function(){
    $(this).next(".dropdown_content").toggle("slow");
});

if (isMobile) {
    $("menu .details a").click(function(){
        if ($(this).index() == 0){
            $(this).attr("href", "tel:1234567890");
        }
        if ($(this).index() == 3){
            popup('<i class="fa fa-times"></i></a><iconify-icon icon="bx:error"></iconify-icon><aside><h3 class="title small">Timings may vary</h3><p>For accurate timings please connect through a call & confirm.</p></aside>', 'alert');
        }
    });
} else {
    $("menu .details a").click(function(){
        switch($(this).index()){
            case 0:
                return popup('<i class="fa fa-times"></i></a><iconify-icon icon="subway:error" class="error"></iconify-icon><aside><h3 class="title small">Unsupported device</h3><p>It looks like your device won\'t support for <b>calling</b>. Kindly use a Mobile device.</p></aside>', 'alert');
                break;
            case 3:
                 popup('<i class="fa fa-times"></i></a><iconify-icon icon="bx:error"></iconify-icon><aside><h3 class="title small">Timings may vary</h3><p>For accurate timings please connect through a call & confirm.</p></aside>', 'alert');
                break;
            default:
                break;
        }
    });
}

function popup(mssg, type){
    if(type == "alert"){
        if ($(".alert").length < 2){
            count++;
            $(".additional").append('<section class="alert alert_'+count+' flex padding_1x"><a href="javascript:void(0)" onclick="closer(\'modal\',\'alert_'+count+'\')" class="close">'+mssg+'</section>');
            setTimeout(function(){$(".alert_"+count).remove();}, 10000);
            if ($(".alert").length > 0){ setTimeout(function(){$(".alert_"+count).prev().remove();}, 4000); }
        }
    }
}

$(".ham").click(function(){
    if ($("menu").css("left") != "0px"){
        $(this).addClass(" hamburger");
        $("body").append('<div class="overlay" onclick="closer()"></div>');
        $("menu").css("left","0px");
        $("body").css({'overflow-y':'hidden'});
    }
});


$(".close").click(function(){
    $(".overlay").remove();
    if ($("menu").css("left") >= "0px"){
        $(".ham").removeClass(" hamburger");
        $("menu").css("left","-105%");
        $("body").css({'overflow-y':'visible'});
    }
});
function closer(type, el){
        if(type=="modal"){
        $("."+el).remove();
        return 1;
        }
    $(".overlay").remove();
    if ($("menu").css("left") >= "0px"){
        $(".ham").removeClass(" hamburger");
        $("menu").css("left","-105%");
        $("body").css({'overflow-y':'visible'});
    }
}

window.onscroll = function() {
    if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {
        $("nav").css("background-color","var(--dark)") ;
        document.getElementById("roll_back").style.display = "flex";
    } else {
        $("nav").css("background-color","transparent") ;
        document.getElementById("roll_back").style.display = "none";
    }
}

Final Output:

Create a Responsive Furniture Website HTML, CSS, JavaScript Guide.gif

Conclusion:

Congratulations on completing this tutorial on creating a responsive furniture website with HTML, CSS, and JavaScript! We've covered a lot of ground, from setting up your project and structuring HTML to styling with CSS and adding interactivity with JavaScript.


By now, you should have a solid understanding of responsive web design principles and how to apply them to your projects. Remember, responsive design is not just about making your website look good on different devices; it's also about providing a seamless and enjoyable experience for your users.


As you continue to work on your furniture website, don't forget to test and optimize for performance and usability. Regularly update your content and stay up-to-date with the latest web development trends and technologies.


We hope this guide has been helpful in your journey to create a successful online presence for your furniture business. If you have any questions or need further assistance, don't hesitate to reach out to the vibrant web development community or seek professional guidance.


Thank you for joining us on this learning adventure, and best of luck with your future web development endeavors!


Code by: Mahesh

That’s a wrap!

I hope you enjoyed this post. Now, with these examples, you can create your own amazing page.

Did you like it? Let me know in the comments below 🔥 and you can support me by buying me a coffee.

And don’t forget to sign up to our email newsletter so you can get useful content like this sent right to your inbox!

Thanks!
Faraz 😊

End of the article

Subscribe to my Newsletter

Get the latest posts delivered right to your inbox


Latest Post