Tell us what’s happening:
I keep failing these two tests:
-
You should associate every input element with a label element.
-
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 have checked my code several times and can not find an input that is missing a label.
I am using:
.radio-group input[type="radio"]:checked + label {
color: green;
}
to update the radio label, which seems to work in the preview.
Any help would be appreciated!
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>
<h1>JOB APPLICATION FORM</h1>
<div class="container">
<form>
<!--Name and email-->
<label for="name">Full name:</label>
<input id="name" placeholder="Please input your full name" type="text" required/>
<label for="email">Email address:</label>
<input id="email" placeholder ="Please input your email address" type="email" required/>
<!--Dropdown selector-->
<label for="position">Desired Position</label>
<select id="position" required>
<option id="default" value="">Please Select</option>
<option value="PM">Product Manager</option>
<option value="DA">Data Analyst</option>
<option value="MS">Marketing Strategist</option>
</select>
<!--Radio Group-->
<fieldset class="radio-group">
<legend>Availability</legend>
<input id="full-time" name="availability" type="radio" required/>
<label for="full-time">Full time</label>
<input id="part-time" name="availability" type="radio"/>
<label for"part-time">Part time</label>
</fieldset>
<!--Text Area-->
<label for="message">Why do you want this job?</label>
<textarea id="message" placeholder="Write your motivation" required></textarea>
<!--Submit Button-->
<label for="submit-button">Ready to submit?</label>
<button id="submit-button" type="submit">Submit Application</button>
</form>
</div>
</body>
</html>
* {
box-sizing: border-box;
}
body {
font-family: arial, san-serif;
background-color: rgb(158, 158, 177);
padding: 20px;
}
h1 {
text-align: center;
color: white;
}
label {
display: block;
font-weight: bold;
margin-bottom: 3px;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: ghostwhite;
border-radius: 15px;
box-shadow: 3px 3px rgb(23, 39, 55);
}
input:valid,
select:valid,
textarea:valid {
border: solid 2px green;
outline: none;
}
.radio-group input[type="radio"]:valid {
border: solid 2px #ccc;
outline: none;
background-color: transparent;
}
input,
select,
textarea {
width: 100%;
padding: 5px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}
input:invalid,
select:invalid,
textarea:invalid {
border: solid 1px red;
outline: none;
}
input:focus,
textarea:focus {
border: solid 3px purple;
outline: none;
}
.radio-group {
display: flex;
align-items: center;
}
fieldset label {
margin-right: 20px
}
.radio-group input[type="radio"] {
appearance: none;
border-radius: 50%;
outline: none;
width: 20px;
height: 20px;
margin-top: 10px;
cursor: pointer;
}
.radio-group input[type="radio"]:checked {
border: solid 2px green;
background-color: green;
box-shadow: inset 0 0 0 3px white;
}
.radio-group input[type="radio"]:checked + label {
color: green;
}
button {
display: block;
margin: 0 auto;
width: 80%;
border: 1px solid slategray;
border-radius: 6px;
padding: 6px;
background-color: lavender;
font-weight: bold;
font-size: 105%;
}
button:hover {
background-color: slateblue;
color: white;
cursor: pointer;
}
#default {
color: rgb(187, 187, 232);
}
input::placeholder {
color: rgb(187, 187, 232);
}
fieldset {
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 15px;
}
input:first-of-type {
border-radius: 50px;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Build a Job Application Form - Build a Job Application Form
https://www.freecodecamp.org/learn/full-stack-developer/lab-job-application-form/lab-job-application-form