formulaire 03

code original sur: https://developer.mozilla.org/fr/docs/Web/Guide/HTML/Formulaires/Mon_premier_formulaire_HTML

Code exemple 03:

/* CSS */
form {
  margin: 0 auto;
  width: 300px;
  padding: 1em;
  border: 1px solid #CCC;
  border-radius: 1em;
  background-color: #A1A1A1;
}

form div + div {
  margin-top: 1em;
}

label, input, textarea {
	display: block;
}

label {
	font-family: "Roboto", sans-serif;
	font-weight: bold;
	font-size: 0.9em;
	text-align: right;
}

input, textarea{
  	font: 0.9em sans-serif;
  	width: 300px;
  	box-sizing: border-box;
  	border: 1px solid #999;
}

input:focus, textarea:focus {
  	border-color: #000;
}

textarea {
  	height: 15em;
}

button {
	margin-left: 43%;
	font-family: "Roboto", sans-serif;
	font-weight: bold;
	font-size: 0.9em;
	text-align: right;
}
	

/* HTML */				
<form action="/URL" method="post">
    <div>
        <label for="name">Nom :</label>
        <input type="text" id="name" name="user_name">
    </div>
    <div>
        <label for="mail">e-mail :</label>
        <input type="email" id="mail" name="user_mail">
    </div>
    <div>
        <label for="msg">Message :</label>
        <textarea id="msg" name="user_message"></textarea>
    </div>
	 <div>
        	<button type="submit">Envoyer le message</button>
    </div>  
</form>