In today’s digital age, having a responsive and visually appealing landing page is crucial for any business or personal brand. A well-designed landing page not only attracts visitors but also converts them into customers. In this guide, we’ll walk you through building a modern landing page using HTML5 and Tailwind CSS.
Why Choose HTML5 and Tailwind CSS?
HTML5 provides the structure for your webpage, while Tailwind CSS offers utility-first classes that make styling efficient and responsive. This combination allows for rapid development without compromising on design quality.
Check out our Ultimate Guide to Website App Design That Converts.
Prerequisites
- Basic understanding of HTML and CSS
- Familiarity with Tailwind CSS is a plus but not necessary
Getting Started
1. Setting Up the Project
Create a new HTML file and include the Tailwind CSS CDN in the <head>
section:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Name - Real Estate Professional</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
html {
scroll-behavior: smooth;
}
</style>
</head>
<body class="relative">
<!-- Your content here -->
</body>
</html>
Explanation:
<!DOCTYPE html>
: Declares the document type as HTML5.<html lang="en">
: Sets the language attribute to English for accessibility and SEO purposes.- Meta Tags:
<meta charset="UTF-8">
: Specifies the character encoding for the HTML document, ensuring proper display of characters.<meta name="viewport" content="width=device-width, initial-scale=1.0">
: Ensures the website is responsive on mobile devices by setting the viewport to match the device’s width.
<title>
: Sets the title of the webpage, which appears on the browser tab and in search engine results.- Tailwind CSS Inclusion:
<script src="https://cdn.tailwindcss.com"></script>
: Includes Tailwind CSS via CDN, allowing us to use its utility classes throughout the document.
- Custom Styles:
<style> html { scroll-behavior: smooth; } </style>
: Adds smooth scrolling behavior when navigating to different sections of the page using anchor links.
<body class="relative">
: Applies a relative positioning context to the body, useful for absolutely positioned elements within.
Interested in automating your workflow? Read our article on Best Automation Software for Small Businesses.
2. Building the Navigation Bar
We’ll create a responsive, sticky navigation bar.
<!-- Navigation Bar -->
<nav class="bg-white fixed w-full z-30 top-0 shadow">
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
<div class="text-2xl font-bold text-gray-800">
Your Name
</div>
<div class="hidden md:flex space-x-6">
<a href="#" class="text-gray-800 hover:text-blue-600">Home</a>
<a href="#listings" class="text-gray-800 hover:text-blue-600">Listings</a>
<a href="#about" class="text-gray-800 hover:text-blue-600">About</a>
<a href="#testimonials" class="text-gray-800 hover:text-blue-600">Testimonials</a>
<a href="#contact" class="text-gray-800 hover:text-blue-600">Contact</a>
</div>
<!-- Mobile menu button -->
<div class="md:hidden">
<button id="mobile-menu-button" class="text-gray-800 hover:text-blue-600 focus:outline-none">
<svg class="w-6 h-6" fill="none" stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
</svg>
</button>
</div>
</div>
<!-- Mobile menu -->
<div id="mobile-menu" class="hidden md:hidden">
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
<a href="#" class="block text-gray-800 hover:text-blue-600">Home</a>
<a href="#listings" class="block text-gray-800 hover:text-blue-600">Listings</a>
<a href="#about" class="block text-gray-800 hover:text-blue-600">About</a>
<a href="#testimonials" class="block text-gray-800 hover:text-blue-600">Testimonials</a>
<a href="#contact" class="block text-gray-800 hover:text-blue-600">Contact</a>
</div>
</div>
</nav>
Explanation:
<nav>
: Defines the navigation section.class="bg-white fixed w-full z-30 top-0 shadow"
:bg-white
: Sets the background color to white.fixed w-full top-0
: Fixes the navbar to the top of the viewport and spans the full width.z-30
: Ensures the navbar stays above other elements using the z-index.shadow
: Adds a subtle shadow below the navbar for depth.
- Container Div:
class="container mx-auto px-4 py-4 flex items-center justify-between"
:container mx-auto
: Centers the content horizontally within the viewport.px-4 py-4
: Adds padding on the x (horizontal) and y (vertical) axes.flex items-center justify-between
: Uses Flexbox to align items centrally and space them apart.
- Logo/Brand Name:
<div class="text-2xl font-bold text-gray-800">Your Name</div>
: Displays the brand name with larger, bold text.
- Navigation Links:
<div class="hidden md:flex space-x-6">
:hidden md:flex
: Hides the links on small screens and displays them as a flex container on medium screens and larger.space-x-6
: Adds horizontal spacing between the links.
- Each
<a>
tag represents a navigation link with hover effects.
- Mobile Menu Button:
<div class="md:hidden">
: Displays the menu button only on small screens.- The button uses an SVG icon representing the hamburger menu.
- Mobile Menu:
<div id="mobile-menu" class="hidden md:hidden">
: The mobile menu is hidden by default and only appears when toggled.- Contains navigation links similar to the desktop version but styled for mobile.
3. Creating the Hero Section
The hero section is the first thing visitors see. We’ll use a background image with overlay text.
<!-- Hero Section -->
<section class="relative h-screen pt-20">
<div class="absolute inset-0 bg-gradient-to-r from-black to-transparent z-10"></div>
<img src="https://via.placeholder.com/1920x1080" alt="Luxury Home Exterior" class="absolute inset-0 w-full h-full object-cover">
<div class="relative z-20 container mx-auto px-4 h-full flex items-center">
<div class="max-w-2xl">
<h1 class="text-5xl font-bold text-white mb-4">Find Your Dream Home in [Location]</h1>
<p class="text-xl text-white mb-8">Expert guidance through every step of your real estate journey</p>
<a href="#listings" class="bg-blue-600 text-white px-8 py-3 rounded-lg hover:bg-blue-700 transition">
View Listings
</a>
</div>
</div>
</section>
Explanation:
<section class="relative h-screen pt-20">
:relative
: Positions the section relatively to contain absolutely positioned child elements.h-screen
: Sets the height of the section to fill the viewport height.pt-20
: Adds top padding to offset the fixed navbar height.
- Background Gradient Overlay:
<div class="absolute inset-0 bg-gradient-to-r from-black to-transparent z-10"></div>
:absolute inset-0
: Positions the div absolutely, covering the entire section.bg-gradient-to-r from-black to-transparent
: Creates a gradient overlay from black to transparent, enhancing text readability over the background image.z-10
: Places the gradient above the background image but below the content.
- Background Image:
<img src="..." class="absolute inset-0 w-full h-full object-cover">
:absolute inset-0
: Positions the image absolutely to cover the entire section.w-full h-full
: Ensures the image fills the width and height of the section.object-cover
: Scales the image to cover the container while maintaining aspect ratio.
- Content Container:
<div class="relative z-20 container mx-auto px-4 h-full flex items-center">
:relative z-20
: Positions the content above the gradient overlay.h-full flex items-center
: Vertically centers the content within the section.
- Text Content:
<h1>
and<p>
: Display the main heading and subheading with appropriate text sizes and colors.- Call-to-Action Button:
<a href="#listings" class="bg-blue-600 text-white px-8 py-3 rounded-lg hover:bg-blue-700 transition">
:bg-blue-600
: Sets the button background color.rounded-lg
: Adds rounded corners.hover:bg-blue-700 transition
: Changes background color on hover with a smooth transition.
For insights on SEO optimization, don’t miss our Edge SEO Guide.
4. Adding Featured Listings
Display your top properties using a grid layout.
<!-- Featured Listings -->
<section id="listings" class="py-16 bg-gray-50 scroll-mt-20">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12">Featured Listings</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Property Card 1 -->
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
<img src="https://via.placeholder.com/400x300" alt="Property" class="w-full h-48 object-cover">
<div class="p-6">
<h3 class="text-xl font-semibold mb-2">Modern Downtown Condo</h3>
<p class="text-gray-600 mb-4">$599,000</p>
<div class="flex justify-between text-sm text-gray-500">
<span>3 Beds</span>
<span>2 Baths</span>
<span>1,500 Sq Ft</span>
</div>
</div>
</div>
<!-- Property Card 2 -->
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
<img src="https://via.placeholder.com/400x300" alt="Property" class="w-full h-48 object-cover">
<div class="p-6">
<h3 class="text-xl font-semibold mb-2">Spacious Suburban Home</h3>
<p class="text-gray-600 mb-4">$799,000</p>
<div class="flex justify-between text-sm text-gray-500">
<span>4 Beds</span>
<span>3 Baths</span>
<span>2,800 Sq Ft</span>
</div>
</div>
</div>
<!-- Property Card 3 -->
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
<img src="https://via.placeholder.com/400x300" alt="Property" class="w-full h-48 object-cover">
<div class="p-6">
<h3 class="text-xl font-semibold mb-2">Cozy Country Cottage</h3>
<p class="text-gray-600 mb-4">$450,000</p>
<div class="flex justify-between text-sm text-gray-500">
<span>2 Beds</span>
<span>1 Bath</span>
<span>1,200 Sq Ft</span>
</div>
</div>
</div>
</div>
</div>
</section>
Explanation:
<section id="listings" class="py-16 bg-gray-50 scroll-mt-20">
:id="listings"
: Allows for anchor linking to this section.py-16
: Adds vertical padding.bg-gray-50
: Sets a light gray background color.scroll-mt-20
: Adjusts scroll margin to account for the fixed navbar when using anchor links.
- Section Title:
<h2 class="text-3xl font-bold text-center mb-12">Featured Listings</h2>
: Centers and styles the section heading.
- Grid Layout:
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
:grid grid-cols-1
: Defines a grid layout with one column by default.md:grid-cols-2
,lg:grid-cols-3
: Adjusts the number of columns on medium and large screens.gap-8
: Adds spacing between grid items.
- Property Card:
- Container:
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
: Creates a card with a white background, rounded corners, and a shadow.
- Property Image:
<img src="..." class="w-full h-48 object-cover">
: Displays the property image.
- Property Details:
- Title and Price:
<h3>
and<p>
: Show the property title and price.
- Attributes:
<div class="flex justify-between text-sm text-gray-500">
: Displays property features like beds, baths, and square footage in a flex container.
- Title and Price:
- Container:
5. Creating the About Section
Introduce yourself or your business.
<!-- About Section -->
<section id="about" class="py-16 scroll-mt-20">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row items-center gap-12">
<div class="md:w-1/2">
<img src="https://via.placeholder.com/400x400" alt="Real Estate Agent" class="rounded-lg shadow-lg">
</div>
<div class="md:w-1/2">
<h2 class="text-3xl font-bold mb-6">About [Your Name]</h2>
<p class="text-gray-600 mb-6">
With over [X] years of experience in [Location] real estate...
</p>
<ul class="space-y-4">
<li class="flex items-center">
<svg class="w-6 h-6 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"/>
</svg>
[X] Properties Sold
</li>
<!-- Add more achievements -->
</ul>
</div>
</div>
</div>
</section>
Explanation:
<section id="about" class="py-16 scroll-mt-20">
:- Similar to previous sections, includes padding and scroll margin adjustments.
- Content Layout:
<div class="flex flex-col md:flex-row items-center gap-12">
:flex flex-col
: Stacks items vertically on small screens.md:flex-row
: Aligns items horizontally on medium screens and above.items-center
: Vertically centers items within the flex container.gap-12
: Adds space between the image and text content.
- Image:
<div class="md:w-1/2">
: Sets the image container to half the width on medium screens and above.<img src="..." class="rounded-lg shadow-lg">
: Displays the agent’s photo with rounded corners and a shadow.
- Text Content:
<h2>
: Section heading.<p>
: Description or bio.- Achievements List:
<ul class="space-y-4">
: Adds vertical spacing between list items.- List Items:
<li class="flex items-center">
: Aligns the icon and text horizontally.- SVG Icon: Represents a checkmark or achievement symbol.
- Text: Describes the achievement.
Enhance your site’s SEO with our guide on Optimizing WordPress with Yoast SEO.
6. Adding Testimonials
Showcase client feedback to build trust.
<!-- Testimonials Section -->
<section id="testimonials" class="py-16 bg-gray-50 scroll-mt-20">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12">What My Clients Say</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Testimonial Card 1 -->
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex items-center mb-4">
<img src="https://via.placeholder.com/48" alt="Client" class="w-12 h-12 rounded-full mr-4">
<div>
<h4 class="font-semibold">John Doe</h4>
<p class="text-gray-500">Homeowner</p>
</div>
</div>
<p class="text-gray-600">"Working with [Your Name] was an incredible experience..."</p>
</div>
<!-- Testimonial Card 2 -->
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex items-center mb-4">
<img src="https://via.placeholder.com/48" alt="Client" class="w-12 h-12 rounded-full mr-4">
<div>
<h4 class="font-semibold">Jane Smith</h4>
<p class="text-gray-500">Seller</p>
</div>
</div>
<p class="text-gray-600">"[Your Name] made selling our home a smooth process..."</p>
</div>
<!-- Testimonial Card 3 -->
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex items-center mb-4">
<img src="https://via.placeholder.com/48" alt="Client" class="w-12 h-12 rounded-full mr-4">
<div>
<h4 class="font-semibold">Michael Brown</h4>
<p class="text-gray-500">Investor</p>
</div>
</div>
<p class="text-gray-600">"I highly recommend [Your Name] for any real estate needs..."</p>
</div>
</div>
</div>
</section>
Explanation:
- Section Structure:
- Similar to previous sections with padding and background color.
- Grid Layout:
- Organizes testimonial cards into a responsive grid.
- Testimonial Card:
- Container:
<div class="bg-white p-6 rounded-lg shadow">
: Creates a card with padding, rounded corners, and a shadow.
- Client Info:
<div class="flex items-center mb-4">
: Aligns the client’s photo and name horizontally.- Client Photo:
<img src="..." class="w-12 h-12 rounded-full mr-4">
: Displays a circular client photo.
- Client Details:
- Contains the client’s name and role.
- Testimonial Text:
<p class="text-gray-600">
: Displays the client’s feedback.
- Container:
7. Building the Contact Form
Allow visitors to get in touch easily.
<!-- Contact Section -->
<section id="contact" class="py-16 scroll-mt-20">
<div class="container mx-auto px-4 max-w-xl">
<h2 class="text-3xl font-bold text-center mb-12">Let's Connect</h2>
<form class="space-y-6">
<div>
<label class="block text-gray-700 mb-2">Name</label>
<input type="text" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-gray-700 mb-2">Email</label>
<input type="email" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-gray-700 mb-2">Message</label>
<textarea class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500" rows="4"></textarea>
</div>
<button type="submit" class="w-full bg-blue-600 text-white px-6 py-3 rounded-lg hover:bg-blue-700 transition">
Send Message
</button>
</form>
</div>
</section>
Explanation:
- Section Structure:
<section id="contact"
: Marks the contact section for anchor linking.class="py-16 scroll-mt-20"
: Adds padding and scroll margin.
- Container:
<div class="container mx-auto px-4 max-w-xl">
:max-w-xl
: Limits the width of the form for better readability.
- Form:
class="space-y-6"
: Adds vertical spacing between form elements.
- Form Fields:
<label>
: Descriptive labels for accessibility.- Input Fields:
class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500"
:w-full
: Input spans the full width of the container.border rounded-lg
: Adds a border and rounded corners.focus:ring-2 focus:ring-blue-500
: Adds a blue outline when the input is focused.
- Submit Button:
- Styled similarly to other buttons for consistency.
Want to learn about engaging content? Read our article on Mastering Sales Funnels in 2025.
8. Footer
Include social media links and any additional scripts.
<!-- Footer -->
<footer class="bg-gray-900 text-white pt-16 pb-8">
<div class="container mx-auto px-4">
<!-- Main Footer Content -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12 mb-12">
<!-- Company Info -->
<div>
<h3 class="text-xl font-semibold mb-4">Your Real Estate Brand</h3>
<p class="text-gray-400 mb-4">
Making your real estate dreams a reality since [Year].
Licensed in [State/Region].
</p>
<div class="flex space-x-4">
<!-- Social Media Links -->
<a href="#" class="text-gray-400 hover:text-white transition">
<!-- Facebook icon -->
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d="M18.77 7.46H14.5v-1.9c0-.9.6-1.1 1-1.1h3V.5h-4.33C10.24.5 9.5 3.44 9.5 5.32v2.15h-3v4h3v12h5v-12h3.85l.42-4z"/>
</svg>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<!-- Instagram icon -->
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/>
</svg>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<!-- LinkedIn icon -->
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d="M4.98 3.5c0 1.381-1.11 2.5-2.48 2.5s-2.48-1.119-2.48-2.5c0-1.38 1.11-2.5 2.48-2.5s2.48 1.12 2.48 2.5zm.02 4.5h-5v16h5v-16zm7.982 0h-4.968v16h4.969v-8.399c0-4.67 6.029-5.052 6.029 0v8.399h4.988v-10.131c0-7.88-8.922-7.593-11.018-3.714v-2.155z"/>
</svg>
</a>
</div>
</div>
<!-- Quick Links -->
<div>
<h3 class="text-xl font-semibold mb-4">Quick Links</h3>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Home Search</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Featured Listings</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Market Reports</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Buyer's Guide</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Seller's Guide</a></li>
</ul>
</div>
<!-- Contact Info -->
<div>
<h3 class="text-xl font-semibold mb-4">Contact Info</h3>
<ul class="space-y-2">
<li class="flex items-center text-gray-400">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
123 Real Estate Ave, City, State
</li>
<li class="flex items-center text-gray-400">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"/>
</svg>
(555) 123-4567
</li>
<li class="flex items-center text-gray-400">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
</svg>
contact@yourdomain.com
</li>
</ul>
</div>
<!-- Newsletter Signup -->
<div>
<h3 class="text-xl font-semibold mb-4">Stay Updated</h3>
<p class="text-gray-400 mb-4">Subscribe to our newsletter for market updates and exclusive listings.</p>
<form class="space-y-2">
<input type="email" placeholder="Enter your email"
class="w-full px-4 py-2 bg-gray-800 text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<button type="submit"
class="w-full bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition">
Subscribe
</button>
</form>
</div>
</div>
<!-- Bottom Bar -->
<div class="border-t border-gray-800 pt-8">
<div class="flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-400 text-sm">
© 2024 Your Real Estate Brand. All rights reserved.
</p>
<div class="flex space-x-6 mt-4 md:mt-0">
<a href="#" class="text-gray-400 hover:text-white text-sm transition">Privacy Policy</a>
<a href="#" class="text-gray-400 hover:text-white text-sm transition">Terms of Service</a>
<a href="#" class="text-gray-400 hover:text-white text-sm transition">Sitemap</a>
</div>
</div>
</div>
</div>
</footer>
Explanation:
- Footer Structure:
<footer class="bg-gray-900 text-white pt-16 pb-8">
: Sets the background color, text color, and padding.
- Main Content:
- Grid Layout:
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12 mb-12">
:- Arranges footer content into responsive columns.
- Sections:
- Company Info: Includes brand name, description, and social media links.
- Quick Links: Provides navigational links.
- Contact Info: Displays address, phone, and email.
- Newsletter Signup: Allows users to subscribe to updates.
- Grid Layout:
- Bottom Bar:
<div class="border-t border-gray-800 pt-8">
: Adds a top border and padding.- Content Layout:
flex flex-col md:flex-row justify-between items-center
: Arranges content vertically on small screens and horizontally on medium screens and above.
- Links: Privacy Policy, Terms of Service, and Sitemap.
Social Media Icons
- Uses SVG icons for Facebook, Instagram, and LinkedIn.
- Each icon is wrapped in an
<a>
tag for linking to social media profiles. - Styling:
class="text-gray-400 hover:text-white transition"
: Sets the initial icon color and changes it on hover.
9. Mobile Menu Scripts
<!-- Mobile Menu Script -->
<script>
const menuButton = document.getElementById('mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
menuButton.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
});
</script>
Explanation:
- Reiterates the functionality for the mobile menu, ensuring it works throughout the page.
SEO Optimization in the Code
- Meta Tags:
- Include
<meta name="description" content="...">
for a page description.
- Include
- Alt Attributes:
- All
<img>
tags includealt
attributes to improve accessibility and SEO.
- All
- Anchor Links and IDs:
- Section IDs enable smooth navigation and help search engines understand the page structure.
- Semantic HTML:
- Using appropriate HTML elements (e.g.,
<nav>
,<section>
,<footer>
) improves SEO.
- Using appropriate HTML elements (e.g.,
For a complete SEO checklist, visit our Local SEO Checklist.
Final Product
Final Thoughts
Building a responsive landing page with HTML5 and Tailwind CSS is both efficient and effective. With this guide, you can create a professional-looking page that engages visitors and drives conversions.