Bien sûr, voici un exemple de code HTML, CSS et JS pour une page d'accueil d'une auto-école, qui contient un formulaire d'inscription :
HTML :
<!DOCTYPE html>
<html>
<head>
<title>Auto-école XYZ</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<h1>Auto-école XYZ</h1>
</header>
<nav>
<ul>
<li><a href="#">Accueil</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Tarifs</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<main>
<section id="inscription">
<h2>Inscrivez-vous maintenant</h2>
<form>
<label>Nom :</label>
<input type="text" name="nom" id="nom" required>
<label>Prénom :</label>
<input type="text" name="prenom" id="prenom" required>
<label>Téléphone :</label>
<input type="tel" name="telephone" id="telephone" required>
<label>Email :</label>
<input type="email" name="email" id="email" required>
<label>Catégorie de permis :</label>
<select name="permis" id="permis">
<option value="auto">Permis Auto</option>
<option value="moto">Permis Moto</option>
<option value="camion">Permis Camion</option>
</select>
<input type="submit" value="S'inscrire">
</form>
</section>
</main>
<footer>
<p>© Auto-école XYZ - Tous droits réservés</p>
</footer>
</body>
</html>
CSS :
body {
font-family: Arial, sans-serif;
margin: 0;
}
header {
background-color: #333;
color: white;
padding: 20px;
text-align: center;
}
h1 {
margin: 0;
}
nav {
background-color: #ddd;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
li a {
display: block;
color: #333;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #eee;
}
main {
padding: 20px;
display: flex;
flex-wrap: wrap;
}
section {
width: 100%;
}
h2 {
margin-bottom: 20px;
}
label, input, select {
display: block;
width: 100%;
margin-bottom: 10px;
}
input[type="submit"] {
background-color: #333;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
}
input[type="submit"]:hover {
background-color: #555;
}
footer {
background-color: #333;
color: white;
padding: 20px;
text-align: center;
}
JS :
// Ajoute une animation de transition lors du clic sur les liens de la navigation
let liens_nav = document.querySelectorAll("nav ul li a");
for (let i = 0; i < liens_nav.length; i++) {
liens_nav[i].addEventListener("click", function(event) {
event.preventDefault();
let target = event.target.getAttribute("href");
let target_element = document.querySelector(target);
target_element.scrollIntoView({
behavior: "smooth",
block: "start"
});
});
}
Cet exemple a pour but de vous donner une idée de ce que peut être le HTML, CSS et JS pour une page d'accueil d'une auto-école. À partir de là, vous pouvez personnaliser ce code et ajouter d'autres fonctionnalités et pages pour votre site web.