- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Asociar una etiqueta y un campo mediante id</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Iniciar sesión</h1>
<form action="https://echo.htmlacademy.ru/courses" method="post">
<table>
<tr>
<td>
Tu nombre de usuario
</td>
<td>
<input type="text" name="login">
</td>
</tr>
<tr>
<td>Etiqueta</td>
<td>Otro campo</td>
</tr>
<tr>
<td></td>
<td>Botón de envío</td>
</tr>
</table>
</form>
</body>
</html>
CSS
table {
border-collapse: collapse;
}
td {
padding: 10px;
border: 1px solid #cccccc;
}
tr:nth-child(n+2) {
color: #cccccc;
}
Ha ido a otra página
ObjetivosRealizado
0
- Agrega al campo del nombre de usuario el identificador
login-field. - Envuelve el texto
Tu nombre de usuarioen la etiqueta<label>. La etiqueta<label>debe quedar dentro de<td>. - Asocia la etiqueta con el campo del nombre de usuario mediante el atributo
for.
Haz clic en la etiqueta para comprobar que el campo se activa.