What You'll Build

By the end of this tutorial, you'll have a complete, professional landing page built with pure HTML and CSS โ€” no frameworks, no JavaScript required. It will include a navigation bar, a hero section with a headline and CTA button, a features section with a card grid, and a footer. You can build and preview it in your browser as you go, in the HTML Runner or any editor with a live preview.

Step 1: HTML Structure โ€” The Semantic Skeleton

Start with clean semantic HTML. Put this in index.html. The <link> in the head loads the stylesheet you will write next:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Product โ€” The Best Way to X</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>

    <nav class="navbar">
        <div class="nav-brand">MyProduct</div>
        <div class="nav-links">
            <a href="#features">Features</a>
            <a href="mailto:[email protected]">Contact</a>
            <a href="#" class="nav-cta">Get Started</a>
        </div>
    </nav>

    <section class="hero">
        <div class="hero-content">
            <span class="hero-badge">New in 2026</span>
            <h1>The Fastest Way to <span class="highlight">Achieve X</span></h1>
            <p class="hero-subtitle">Join 10,000+ users who use MyProduct to save time and ship faster. Free to start, no credit card required.</p>
            <div class="hero-cta">
                <a href="#" class="btn btn-primary">Start Free Trial</a>
                <a href="#features" class="btn btn-ghost">See Features โ†’</a>
            </div>
        </div>
    </section>

    <section class="features" id="features">
        <div class="container">
            <h2>Everything You Need</h2>
            <p class="section-subtitle">Powerful features built for modern teams</p>
            <div class="features-grid">
                <div class="feature-card">
                    <div class="feature-icon">โšก</div>
                    <h3>Lightning Fast</h3>
                    <p>Performance-first design means your users get results in milliseconds, not seconds.</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">๐Ÿ”’</div>
                    <h3>Secure by Default</h3>
                    <p>Enterprise-grade security baked in from day one, not bolted on after.</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">๐Ÿ“ฑ</div>
                    <h3>Works Everywhere</h3>
                    <p>Responsive design ensures a perfect experience on any device or screen size.</p>
                </div>
            </div>
        </div>
    </section>

    <footer class="footer">
        <p>ยฉ 2026 MyProduct. All rights reserved.</p>
    </footer>

</body>
</html>

Step 2: CSS Reset and Global Styles

Create styles.css (in the HTML Runner it is already there as a tab) and start with a reset and global variables:

/* Reset & Global */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --text: #0f172a;
    --text-muted: #64748b;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

Step 3: Style the Navigation Bar

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-cta {
    background: var(--primary) !important;
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600 !important;
}
.nav-cta:hover { background: var(--primary-dark) !important; }

Step 4: Create the Hero Section

.hero {
    padding: 100px 24px 80px;
    text-align: center;
    background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
}

.hero-content {
    max-width: 720px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: #ede9fe;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 24px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--text);
}

.highlight {
    color: var(--primary);
    background: linear-gradient(120deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 36px;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}

.btn-ghost {
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--bg);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

Step 5: Build the Features Grid

.features {
    padding: 80px 0;
    background: var(--bg-alt);
    text-align: center;
}

.features h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 0;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: left;
    transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

Step 6: Footer and Final Touches

.footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive: stack nav links on mobile */
@media (max-width: 640px) {
    .navbar { padding: 0 16px; }
    .nav-links { gap: 16px; }
    .hero-cta { flex-direction: column; align-items: center; }
}

๐Ÿ’ก Pro Tip: Use CSS Custom Properties for Theming

Define all your brand colors as CSS variables in :root. To create a dark mode version, just add a [data-theme="dark"] block that overrides those variables. No need to change individual property values throughout your CSS.

Step 7: Preview and Export

Check the page in the live preview after each section, and narrow the preview to make sure the features grid stacks into one column on small screens. Before publishing, paste index.html into the HTML validator to catch unclosed tags or links to missing sections.

To publish, you need the files themselves:

  • In the HCODX editor, create index.html and styles.css in the file tree and choose Export. The ZIP contains the same files and folders you see in the tree.
  • In the HTML Runner, Export ZIP downloads a single index.html that loads your CSS, plus your original files in a sources folder.

Upload the files to a static host such as GitHub Pages, Netlify or Cloudflare Pages. The export and deploy guide walks through each one.

What to Add Next

  • Pricing section โ€” two or three plan cards with a comparison list
  • Testimonials โ€” quote cards with avatar images
  • FAQ accordion โ€” expandable questions using CSS transitions
  • Smooth scroll โ€” scroll-behavior: smooth on the html element
  • Animations โ€” fade-in sections using CSS @keyframes and animation-delay
  • Form โ€” email capture input with a submit button

Conclusion

Building a landing page with pure HTML and CSS is one of the most valuable front-end skills you can develop. The combination of semantic HTML, CSS custom properties, Flexbox, Grid, and responsive media queries produces professional results without requiring any framework. By building in HCODX with live preview, you see every change instantly and can export a deployment-ready project when finished. This is the fastest path from idea to live landing page.

Build Your Landing Page Right Now

Paste the HTML and CSS from this tutorial into the HTML Runner and change the copy, colors and spacing to make it yours.

Open the HTML Runner โ†’