Tell us what’s happening:
Hello!
I am stuck on step 15, “Use the :checked pseudo-class on radio buttons to change the text color of the associated label when the option is selected.”
I have tried so many things and cannot figure it out.
I am not a designer so CSS is in shambles and very unorganized… I am trying to work on that part.
Thank you 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.0">
<link rel="stylesheet" href="styles.css" />
<title>Job Application Form</title>
</head>
<body>
<h1>Fill out this form!</h1>
<div class="container">
<form>
<input type="text" id="name" placeholder="John Doe" required/>
<input type="email" id="email" placeholder="email@email.com" required/>
<select id="position" required>
<option>Select a Position</option>
<option>Developer</option>
<option>Designer</option>
<option>Manager</option>
</select>
<fieldset class="radio-group">
<legend>Availability:</legend>
<input type="radio" label="fullTime" name="availability">
<label for="fullTime">Full-Time</label>
</input>
<input type="radio" label="partTime" name="availability">
<label for="partTime">Part-Time</label>
</input>
</fieldset>
<textarea id="message" name="message" placeholder="Write your motivation!" required></textarea>
<button type="submit">Submit your application</button>
</fieldset>
</body>
</html>
/* file: styles.css */
body {
font-family: arial, sans-serif;
background-color: #eef2e0;
}
h1 {
text-align: center;
}
div {
background-color: ivory;
border: 1px solid black;
border-radius: 2%;
text-align: left;
}
input, textarea, select{
display: block;
width: 100%;
padding: auto;
margin-bottom: 15px;
border-radius: 4px;
box-sizing: border-box;
}
.radio-group {
display: flex
;
align-items: center;
margin-top: 15px;
}
button{
background-color: green;
display: block;
width: 100%;
padding: auto;
font-size: 20px;
border: 0px solid white;
border-radius: 4px;
color: white;
}
input:focus, textarea:focus {
border-color: black;
}
input:invalid, select:invalid, textarea:invalid {
border-color: red;
}
input:valid, select:valid, textarea:valid {
border-color: green;
}
button:hover {
background-color: gray;
}
.radio-group input[type="radio"]:checked {
border-color: green;
background-color: green;
box-shadow: inset 0px 0px 0px 0px white;
}
input[type="radio"]:checked + label {
color: orange;
}
input:first-of-type {
color: gray;
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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