JSFiddle - React, Tailwind, and code Playground

by gabrieleromanato

HTML

<form action="#" method="post">
    <ul>
        <li>
            <label for="name" class="required">Name</label>
            <input type="text" name="name" id="name" />
        </li>
        <li>
            <label for="email" class="required">E-mail</label>
            <input type="text" name="email" id="email" />
        </li>
        <li>
            <label for="phone">Phone</label>
            <input type="text" name="phone" id="phone" />
        </li>
    </ul>
<p><input type="submit" id="submit" name="submit" value="Send" /></p>
</form>

CSS

form {
    margin: 2em auto;
    width: 70%;
    font: 90% Arial, sans-serif;
}

form li {
    margin-bottom: 0.5em;
}

form li label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.4em;
}

form li input {
    display: block;
    font: 1.2em Arial, sans-serif;
    width: 12em;
    border: 1px solid #ccc;
    background: #fff;
    padding: 6px;
}

form p input {
    display: block;
    margin: 1em 0;
    width: 6em;
    padding: 0.3em;
    font: 1em Arial, sans-serif;
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 12px;
}

form li label.required:before {
    content: '*';
    font-size: 1.1em;
    font-weight: bold;
    color: #c00;
    position: relative;
    top: 0.3em;
    left: -1em;
}

form li label.required:after {
    content: '(This field is required)';
    font-size: 90%;
    font-weight: normal;
    color: #666;
    padding-left: 0.5em;
}