How to Build a Responsive Landing Page Layout with HTML and CSS

Abhishek Sen
3 min readJun 14, 2023

--

Photo by Taras Shypka on Unsplash

A landing page is a web page that is designed to convert visitors into customers or leads. It is often the first page that a visitor sees when they come to your website, so it is important to make a good first impression.

In this blog post, I will show you how to build a responsive landing page with HTML and CSS. A responsive landing page will look good on any device, from desktop computers to smartphones.

What we are building - https://html-css-js--abhisheksen15.repl.co/

Step 1: Create the Basic Structure

The first step is to create the basic structure of your landing page. This includes creating the HTML elements for the header, navigation bar, main content area, and footer.

Here is an example of the basic HTML structure for a landing page:

<!DOCTYPE html

<html>

<head>

  <title>My Landing Page</title>

</head>

<body>

  <header>

    <h1>My Landing Page</h1>

  </header>

  <nav>

    <ul>

      <li><a href="#">Home</a></li>

      <li><a href="#">About</a></li>

      <li><a href="#">Contact</a></li>

    </ul>

  </nav>

  <main>

    <h2>This is the main content area</h2>

    <p>This is some text that you can use to describe your product or service.</p>

    <img src="image.jpg" alt="Image of your product or service">

  </main>

  <footer>

    <p>Copyright &copy; 2023 My Company</p>

  </footer>

</body>

</html>

Step 2: Add CSS
Now that you have the basic structure of your landing page in place, you can start adding CSS to style it.
Here are some basic CSS rules that you can use to style your landing page:

body 

  font-family: sans-serif;

  background-color: #fff;

}

header {

  background-color: #000;

  color: #fff;

  padding: 20px;

}

nav {

  list-style-type: none;

  margin: 0;

  padding: 0;

}

nav li {

  display: inline-block;

  margin-right: 20px;

}

nav li a {

  color: #fff;

  text-decoration: none;

}

main {

  padding: 20px;

}

footer {

  background-color: #000;

  color: #fff;

  padding: 20px;

}

Step 3: Make the Landing Page Responsive
Finally, you need to make your landing page responsive so that it looks good on all devices.
To do this, you can use CSS media queries. CSS media queries allow you to specify different CSS rules for different screen sizes.
Here is an example of how you can use CSS media queries to make your landing page responsive:

@media screen and (max-width: 768px) 

  nav {
    width: 100%;
  }

  nav li {
    display: block;
  }

}

This code will make the navigation bar full width on devices with a screen width of 768px or less.
And the final result looks like this -

Landing page design

Check out the sample code here -https://replit.com/@AbhishekSen15/Create-responsive-landing-page-layout-using-html-and-CSS?s=app

By following these steps, you can easily build a responsive landing page with HTML and CSS.
Note - This is an example of simple and easy aproach to layout your landing pages and there’re tons of other aproaches to do the same.
Yes! You made it. Thank you for reading.

--

--