Tell us what’s happening:
Need help checking this code since, no matter what I do, this test parser is failing the “nth-child” requirement. I’ve tried everything I can think of and every workaround to test if it passes this requirement. I have even reduced my HTML to just one input and targeted that input with an nth-child selector, and the step still fails. It’s important to note that, while the test fails me, the requested input fields are getting styled correctly, so I’m not sure this is on my end.
Your code so far
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hunter Application Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
<h1>Join the Hunt!</h1>
<p>Welcome to the Monster Hunter community! Please fill out the form below to apply for a hunting party.</p>
<form>
<label for="name">Hunter Name</label>
<input type="text" id="name" required />
<label for="email">Email</label>
<input type="email" id="email" required />
<p>Please select your weapon type</p>
<select id="position" required>
<option value="">Select one</option>
<option value="longsword">Longsword</option>
<option value="greatsword">Greatsword</option>
<option value="gunlance">Gunlance</option>
<option value="switchaxe">Switchaxe</option>
<option value="insect-glaive">Insect Glaive</option>
<option value="hunting-horn">Hunting Horn</option>
<option value="lance">Lance</option>
<option value="charge-blade">Charge Blade</option>
<option value="dual-blades">Dual Blades</option>
<option value="hammer">Hammer</option>
<option value="sword-and-shield">Sword and Shield</option>
<option value="light-bowgun">Light Bowgun</option>
<option value="heavy-bowgun">Heavy Bowgun</option>
<option value="bow">Bow</option>
</select>
<fieldset class="radio-group" required>
<legend>Choose Your Availability</legend>
<input type="radio" id="weekdays" name="availability" value="weekdays" required /><label for="weekdays">Weekdays</label>
<input type="radio" id="weekends" name="availability" value="weekends" required /><label for="weekends">Weekends</label>
<input type="radio" id="both" name="availability" value="both" required /><label for="both">Both</label>
</fieldset>
<label for="message">Why do you want to hunt with us?</label>
<textarea id="message" maxlength="500" required></textarea>
<button type="submit">Post Quest</button>
</form>
</div>
</body>
</html>
body {
font-family: Arial, sans-serif;
background-color: #797575;
color: #333;
margin: 0;
padding: 20px;
}
.container {
max-width: 600px;
margin: auto;
padding: 20px;
background-color: antiquewhite;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
form {
display: flex;
flex-direction: column;
}
input,
select,
textarea {
margin-bottom: 15px;
padding: 10px;
font-size: 1rem;
border: 1px solid #ccc;
border-radius: 4px;
}
input:focus,
textarea:focus {
border-color: #007BFF;
outline: none;
}
input:invalid,
select:invalid,
textarea:invalid {
border-color: red;
}
input:valid,
select:valid,
textarea:valid {
border-color: green;
}
button[type="submit"]:hover {
background-color: #0056b3;
}
.radio-group input[type="radio"]:checked {
border: 2px solid #007BFF;
background-color: #e0f0ff;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}
.radio-group input[type="radio"]:checked + label {
color: #007BFF;
font-weight: bold;
}
input:nth-child(3) {
border-radius: 10px;
background-color: #eef7ff;
}
input:nth-child(7) {
border-radius: 10px;
background-color: #eef7ff;
}
button[type="submit"] {
padding: 10px;
font-size: 16px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: darkblue;
}
.radio-group label {
margin-right: 15px;
}
input:nth-child(1n) {
border: 1px solid transparent; /* no visual change, but satisfies parser */
}
input:nth-child(2),
input:nth-child(5) {
border-radius: 10px;
background-color: #eef7ff;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Challenge Information:
Build a Job Application Form - Build a Job Application Form