Tell us what’s happening:
I couldn’t get the focus state to work, until I realized: it will always take the latest rule, so the order in the instructions is off. Which may be ok, as this gives us a moment to tinker… but in the example, the proper order isn’t honoured either:
Because the validation rules come after :focus (or share specificity without proper sequencing), clicking into a field immediately triggers the validation border instead of showing the yellow focus ring inside the example, maybe worth an update?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Job Application Form</title>
</head>
<body>
<div class="container">
<form>
<label for="name">Full Name</label>
<Input type="text" id="name">
<label for="email">Email Address</label>
<input type="email" id="email">
<label for="position">Job Position</label>
<select id="position">
<option value="">Select a position</option>
<option value="chair-warmer">Chair Warmer</option>
<option value="sessel-pupser">Sessel Pupser</option>
</select>
<fieldset class="radio-group">
<legend>Availability</legend>
<input type="radio" name="availability" value="full-time"
id="full-time">
<label for="full-time">Full-Time</label>
<input type="radio" name="availability" value="part-time"
id="part-time">
<label for="part-time">Part-Time</label>
</fieldset>
<label for="message">Tell us:</label>
<textarea id="message" rows="4" placeholder="What makes you an asset to this chair?">
</textarea>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
/* file: styles.css */
body {
background-color: rgb(216, 247, 216);
align-content: flex;
}
form {
display: flex;
flex-direction: column;
gap: 10px;
}
input:invalid, select:invalid, textarea:invalid {
border: 2px solid red;
}
input:valid, select:valid, textarea:valid {
border: 2px solid green;
}
input:focus, textarea:focus {
outline: none;
border: 2px solid yellow;
}
button {
width: 60px;
align-self: center;
}
button:hover {
background-color: darkgrey;
color: whitesmoke;
}
.radio-group input[type="radio"]:checked {
appearance: none;
border-color: darkgreen;
background-color: lightgreen;
box-shadow: 0 0 3px darkgreen;
width: 12px;
height: 12px;
border-radius: 50%;
}
.radio-group input[type="radio"]:checked + label {
color:darkgreen;
}
input:first-of-type {
color: darkgreen;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:156.0) Gecko/20100101 Firefox/156.0
Challenge Information:
Build a Job Application Form - Build a Job Application Form