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>Simple Newsletter Form</title>
    <meta name="description" content="A simple newsletter form with an email address field, GDPR checkbox and a submit button.">
    <style>
        *, *::before, *::after {
            box-sizing: border-box;
        }
        body {
            font-family: Arial, sans-serif;
            padding: 10px;
        }
        .newsletter-form {
            max-width: 440px;
            margin: 1em auto;
            padding: 20px;  
            border: 1px solid #ddd;
            border-radius: 5px;
            background: #f4f4f4;
        }
        .newsletter-form h2 {
            margin: 0 0 .75rem 0;
            font-size: 1.5em;
        }
        .newsletter-form p {
            margin: 0 0 1em;
            font-size: .9em;
        }
        .newsletter-form details {
            margin: 0 0 1em 0;
        }
        .newsletter-form details summary {
            text-decoration: underline;
            cursor: pointer;
        }
        .newsletter-form details div {
            margin: .5em 0 1em 0;
        }
        .newsletter-form details label {
            display: block;
            cursor: pointer;
        }
        .newsletter-form>div {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: .85em;
        }
        .newsletter-form input[type="email"] {
            display: block;
            width: 100%;
            padding: .85em 1em;
            border: 1px solid #bbb;
            border-radius: 4px;
            font-size: 100%;
        }
        .newsletter-form label{
            cursor: pointer;
        }
        .newsletter-form button[type="submit"] {
            padding: .85em 2em;
            background: #26d;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .newsletter-form button:hover {
            background: #37e;
        }
        .newsletter-form a {
            color: #26d;
        }
        @media screen and (max-width: 639px) {
            .newsletter-form>div {
                flex-direction: column;
            }
            .newsletter-form button[type="submit"] {
                margin-top: 1em;
            }
        }
    </style>
</head>
<body>
    <form action="" class="newsletter-form">
        <h2>Sign up for our newsletter</h2>
        <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ut, alias labore magnam illo incidunt sapiente.</p>
        <details>
            <summary>What can we send you?</summary>
            <div>
                <label>
                    <input type="checkbox" checked /> Weekly news
                </label>
                <label>
                    <input type="checkbox" checked /> Monthly summary
                </label>
                <label>
                    <input type="checkbox" checked /> Important updates
                </label>
            </div>
        </details>          
        <input type="email" name="email" placeholder="Enter your email address" required>
        <div>
            <label>
                <input type="checkbox" name="agree" required /> I agree to the <a href="#">privacy policy</a>.
            </label>
            <button type="submit">Subscribe</button>
        </div>
    </form>
</body>
</html>