HTML Layouts

Preview Source code Open standalone

Set width: full 320 768 1024 1920 custom

Source code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Single Column Responsive HTML Layout</title>
    <meta name="description" content="A single column responsive layout with a top navigation bar.">
    <style>
        body {
            margin: 0;
            font-family: sans-serif;
            background: #ddd;
            min-width: 320px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .wrap {
            max-width: 800px;
            width: 100%;
            background: #fff;
            padding: 1rem 1.5rem;
            box-sizing: border-box;
        }
        header {
            position: relative;
        }
        header h1 {
            font-size: 2rem;
            margin: 1rem 0;
        }
        .nav {
            display: flex;
            justify-content: space-between;
            background-color: #555;
            color: white;
            padding: 1rem;
            box-sizing: border-box;
        }
        .nav a {
            color: white;
            text-decoration: none;
            padding: 0 10px;
        }
        .hamburger {
            display: none;
            font-size: 30px;
            cursor: pointer;
        }
        #menu-toggle {
            display: none;
        }
        #menu-toggle:checked ~ .nav {
            display: block;
        }
        @media (max-width: 1023px) {
            header {
                display: flex;
                justify-content: space-between;
                border-bottom: 1px solid #ccc;
            }
            .nav {
                display: none;
                flex-direction: column;
            }
            .hamburger {
                display: block;
                padding: .75rem 1rem;
                text-align: right;
            }
            #menu-toggle:checked ~ .nav {
                display: flex;
                position: absolute;
                width: 100%;
                top: 100%;
                padding: 0;
            }
            #menu-toggle:checked ~ .nav a {
                display: block;
                padding: 1rem;
            }
            #menu-toggle:checked ~ .nav a:hover {
                background: #999;
            }


        }
    </style>
</head>
<body>
    <div class="wrap">
        <header>
            <h1>MY WEBSITE</h1>
            <input type="checkbox" id="menu-toggle">
            <label for="menu-toggle" class="hamburger">&#9776;</label>
            <div class="nav">
                <a href="#">Home</a>
                <a href="#">About</a>
                <a href="#">Services</a>
                <a href="#">Contact</a>
            </div>
        </header>
        <div class="main-content">
            <h2>Main Content Area</h2>
            <p>This is where the page content goes.</p>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque odio consequuntur dolores maiores illo incidunt rerum, quis, repellendus culpa repellat nemo? Nemo quam officia ex obcaecati quis tenetur commodi beatae!</p>
            <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. A enim ipsa similique, tempora rem nisi perferendis eaque earum modi dolores sed fugiat magnam neque quo quidem sequi quisquam iure perspiciatis?</p>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum similique quia cumque suscipit corrupti aut commodi consequatur voluptate molestiae fuga in quas sit alias quibusdam, sapiente ipsam veritatis maxime magni?</p>
        </div>
    </div>
</body>
</html>