Skip to main content

Exercise 4: Form with Custom Styles

Create a form with custom styles for the input fields and the submit button.

Interactive Solution

DivZone ad link Logo
AI PlatformTurn Code into Customers.Try it free

Solution with complete HTML and CSS code

HTML
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<title>Ejercicio 3</title>
<style>
/* Escribe tu CSS aquí */
form {
width: 300px;
margin: auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
}

label {
margin-bottom: 10px;
display: block;
}

input[type="text"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 10px;
margin: 5px 0 10px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}

input[type="submit"] {
width: 100%;
background-color: #4caf50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<form>
<label for="name">Nombre</label>
<input type="text" id="name" name="name" />

<label for="email">Correo Electrónico</label>
<input type="email" id="email" name="email" />

<label for="password">Contraseña</label>
<input type="password" id="password" name="password" />

<input type="submit" value="Enviar" />
</form>
</body>
</html>
info

🔎Review the following sections where you will find more information on this topic: