Tell us what’s happening:
Hello guys. I keep getting the same error even with a working preview? "18. You should use the :checked pseudo-class on radio buttons to change the text color of the associated label when the option is selected. " I compared my code to the ones in this forum. I used AI to check for mistakes. Tried a couple of different approaches for example even the HAS… and it will always show me the same error. In the preview it works tho… after 2 days someone please tell me whats the issue I can´t find
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>Job Application Form</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<form>
<!--Name -->
<div>
<label for="name">Full Name</label>
<input type="text" id="name" name="name"
required>
</div>
<!--E-Mail-->
<div>
<label for="email">E-Mail</label>
<input type="email" id="email"
name="email" required>
</div>
<!--Position-->
<div>
<label for="position">Job Position</label>
<select id="position" name="position" required>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
</div>
<!-- Availability -->
<fieldset class="radio-group">
<legend>Availability</legend>
<input type="radio" id="full-time" value="full-time" name="availability" required>
<label for="full-time">Full-Time</label>
<input type="radio" id="part-time" value="part-time" name="availability">
<label for="part-time">Part-Time</label>
</fieldset>
<!-- Message -->
<div>
<label for="message">
Why do you want this Job?
</label>
<textarea
id="message"
name="message"
rows="4"
required>
</textarea>
</div>
<!-- Submit -->
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
body {
font-family: Verdana, arial;
background: #7893;
padding: 2rem;
}
.container {
max-width: 500px;
margin: auto;
background: #fff;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
form {
display: flex;
flex-direction: column;
gap: 1rem;
}
label {
display: block;
margin-bottom: 0.25rem;
font-weight: bold;
}
input, select, textarea {
width: 100%;
padding: 0.5rem;
border: 2px solid #ccc;
border-radius: 6px;
font-size: 1rem;
transition: border-color 0.3s;
}
/* First input styled differently */
input:first-of-type {
border-radius: 20px;
background: yellow;
}
/* Focus */
input:focus, textarea:focus {
border-color: dodgerblue;
outline: none;
}
/* Validation */
input:invalid, select:invalid, textarea:invalid {
border-color: red;
}
input:valid, select:valid, textarea:valid {
border-color: green;
}
/* Radio group */
.radio-group {
display: flex;
gap: 1rem;
border: none;
padding: 0;
}
.radio-group input[type="radio"]:checked {
border-color: dodgerblue;
background-color: #e6f2ff;
box-shadow: 0 0 6px rgba(30,144,255,0.6);
}
.radio-group label {
padding: 0.5rem 1rem;
border: 2px solid #ccc;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
color: #333;
}
/* LOOK HERE The preview works but no matter why I try the test fails*/
input[type="radio"]:checked + label { color: red; }
/* Submit button */
button[type="submit"] {
padding: 0.75rem;
border: none;
border-radius: 8px;
background: dodgerblue;
color: white;
font-size: 1rem;
cursor: pointer;
transition: background 0.3s;
}
/* Hover */
button:hover {
background-color: darkblue;
}
input[type="radio"]:checked + label { color: red; }
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Challenge Information:
Build a Job Application Form - Build a Job Application Form