JSFiddle - React, Tailwind, and code Playground

by dan_georges

HTML

<!DOCTYPE html>
<html lang="fr">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Form</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <section>
        <header>
            <h2>Modifier mon profil</h2>
        </header>
        <hr>
        <form action="" id="monFormulaire">
            <div class="divLastName">
                <label for="lastName">Nom</label>
                <input type="text" name="lastName" id="lastName">
            </div>
            <div class="divFirstName">
                <label for="firstName">Prénom</label>
                <input type="text" name="firstName" id="firstName">
            </div>
            <div class="divEmail">
                <label for="email">Email</label>
                <input type="email" name="email" id="email" placeholder="monemail@demo.fr">
            </div>
            <div class="divTel">
                <label for="tel">Téléphone (mobile)</label>
                <input type="tel" name="tet" id="tel">
            </div>
            <div class="divBio">
                <label for="bio">Bio</label>
                <textarea name="bio" id="bio"></textarea>
            </div>
            <div class="divAdresse">
                <label for="adresse">Adresse</label>
                <input type="text" name="adresse" id="adresse">
            </div>
            <div class="divVille">
                <label for="ville">Ville</label>
                <input type="text" name="ville" id="ville">
            </div>
            <div class="divCP">
                <label for="cp">Code Postal</label>
                <input type="number" name="cp" id="cp">
            </div>
            <div class="checkbox">
                <div class="divNews">
                    <input type="checkbox" id="news" name="news">
                    <label for="news">Je souhaite recevoir la newsletter</label>
                </div>
              ...

CSS

* {
    box-sizing: border-box;
}

body {
    font-family: Roboto, Arial, "Helvetica Neue", Helvetica, sans-serif;
    width: calc(100% -40px);
    height: 100%;
    background-color: #f2f2f2;
    display: flex;
    align-items: start;
    justify-content: center;
    margin: 20px;
    padding: 0;
    font-size: 16px;
    line-height: 19px;
}

section {
    background-color: #ffffff;
    padding: 33px 46px 55px 44px;
    box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-bottom: 50px;
}

/*             ---Responsive---               */

/* ---Version mobile--- */
@media (max-width: 600px) {
    Form {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(10, 80px) 50px;
        gap: 21px 17px;
        grid-template-areas:
            "lname"
            "fname"
            "email"
            "tel"
            "bio"
            "bio"
            "adresse"
            "ville"
            "cp"
            "checkbox"
            "submit";
    }

    section {
        width: 95vw;
        height: auto;
        min-width: 410px;
    }

    .submit {
        justify-self: center;
    }

    h2 {
        text-align: center;
    }
}

/* ---Version tablette--- */
@media all and (max-width: 950px) and (min-width: 600px) {
    Form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(2, 80px) 180px repeat(2, 80px) 50px 50px;
        gap: 21px 17px;
        grid-template-areas:
            "lname fname"
            "email tel"
            "bio bio"
            "adresse adresse"
            "ville cp"
            "checkbox checkbox"
            "submit submit";
    }

    section {
        width: 95vw;
        max-height: none;
    }

    .submit {
        justify-self: center;
    }

    h2 {
        text-align: center;
    }
}

/* ---Version pc--- */
@media (min-width: 950px) {
    Form {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
      ...