Tell us what’s happening:
Hello There
Can anyone help me?
I am getting this error although i have tried many different styles but it wont work.
- You should use the :checked pseudo-class on radio buttons to change the text color of the associated label when the option is selected.
Thanks in advance.
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" />
<title>Job Application Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
<form>
<form>
<input type="text" id="name" name="name" placeholder="Full Name" required />
<input type="email" id="email" name="email" placeholder="Email Address" required />
<select id="position" name="position" required>
<option value="" disabled selected>Select Position</option>
<option value="developer">Developer</option>
<option value="designer">Designer</option>
<option value="manager">Manager</option>
</select>
<fieldset class="radio-group">
<legend>Availability</legend>
<div>
<input type="radio" id="fulltime" name="availability" value="fulltime" required />
<label for="fulltime">Full-Time</label>
</div>
<div>
<input type="radio" id="parttime" name="availability" value="parttime" />
<label for="parttime">Part-Time</label>
</div>
</fieldset>
<textarea id="message" name="message" placeholder="Your message..." required></textarea>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
/* file: styles.css */
/* Container styles */
.container {
max-width: 500px;
margin: 20px auto;
font-family: Arial, sans-serif;
}
/* Inputs, select, textarea styles */
input[type="text"],
input[type="email"],
select,
textarea {
width: 100%;
padding: 8px;
margin: 10px 0;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box;
transition: border-color 0.3s ease;
}
/* First input field special style */
input:first-of-type {
border-radius: 10px 10px 4px 4px;
}
/* Fix #10: Add :focus pseudo-class with list selector for inputs and textarea */
input:focus,
textarea:focus {
border-color: #0077cc;
outline: none;
}
/* Invalid input */
input:invalid,
select:invalid,
textarea:invalid {
border-color: red;
}
/* Valid input */
input:valid,
select:valid,
textarea:valid {
border-color: green;
}
/* Radio buttons hidden (revised) */
.radio-group input[type="radio"] {
position: absolute;
opacity: 0;
}
/* Radio labels */
.radio-group label {
display: inline-block;
padding: 8px 15px;
margin-right: 10px;
border: 2px solid #ccc;
border-radius: 4px;
cursor: pointer;
user-select: none;
transition: all 0.3s ease;
font-weight: normal;
color: black;
}
/* Checked radio input styles: Fixes #14, #15, #16 */
.radio-group input[type="radio"]:checked {
border-color: #0077cc;
background-color: #cce4f7;
box-shadow: 0 0 6px #0077cc;
}
/* Fix #17: Change associated label text color when radio is checked */
.radio-group input[type="radio"]:checked+label {
color: red;
background-color: #cce4f7;
border-color: #0077cc;
box-shadow: 0 0 6px #0077cc;
}
/* Submit button styles */
button[type="submit"] {
background-color: #0077cc;
color: white;
padding: 12px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
/* Fix #13: button:hover changes background color */
button:hover {
background-color: #005fa3;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build a Job Application Form - Build a Job Application Form