Build a Job Application Form - Build a Job Application Form

Tell us what’s happening:

After trying everything I can think of, and utilizing AI as well, I can’t seem to solve step 18. Are there a pair of fresh eyes out there that can help locate the problem? :folded_hands:

  1. You should use the :checked pseudo-class on radio buttons to change the text color of the associated label when the option is selected.

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">
    <h1>Job Application</h1>
    
    <form id="jobApplicationForm">
      <div class="form-group">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required>
      </div>

      <div class="form-group">
        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required>
      </div>

      <div class="form-group">
        <label for="position">For which position are you applying?</label>
        <select id="position" name="position" required>
          <option value="">Select an option</option>
          <option value="zookeeper">Zookeeper</option>
          <option value="clown">Clown</option>
          <option value="ventriloquist">Ventriloquist</option>
          <option value="bearded-lady">Bearded Lady</option>
          <option value="other">Other</option>
        </select>
      </div>
      
      <fieldset class="radio-group">
        <legend>Availability:</legend>
        <label>
          <input type="radio" id="full-time" name="availability" value="full-time" required>
          Full-Time
        </label>
        <label>
          <input type="radio" id="part-time" name="availability" value="part-time">
          Part-Time
        </label>
        <label>
          <input type="radio" id="contract" name="availability" value="contract">
          Contract
        </label>
      </fieldset>

      <div class="form-group">
        <label for="message">Message/Cover Letter</label>
        <textarea id="message" name="message" rows="4" required></textarea>
      </div>

      <button type="submit" class="submit-btn">Submit</button>
    </form>
  </div>
</body>
</html>
body {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  padding: 20px;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
}

/* General input/select/textarea styling */
input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  box-sizing: border-box;
}

/* Criterion 11: :focus pseudo-class (list selector in order) */
input:focus,
textarea:focus {
  border-color: #007cba;
  outline: none;
}

/* Criterion 12: :invalid pseudo-class (list selector in order) */
input:invalid,
select:invalid,
textarea:invalid {
  border-color: red;
}

/* Criterion 13: :valid pseudo-class (list selector in order) */
input:valid,
select:valid,
textarea:valid {
  border-color: green;
}

/* Criterion 19: :first-of-type for first input */
input:first-of-type {
  background-color: #e3f2fd;
  border-color: #007cba;
}

/* Radio group styling */
.radio-group {
  border: 2px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 20px;
}

.radio-group legend {
  font-weight: bold;
  color: #555;
  padding: 0 5px;
}

.radio-group label {
  display: flex;
  align-items: center;
  font-weight: normal;
  cursor: pointer;
  margin-bottom: 10px;
  transition: color 0.3s;
}


.radio-group input[type="radio"] {
  margin-right: 8px;
  cursor: pointer;
  accent-color: #007cba;
}

/* Criteria 15, 16, 17: :checked pseudo-class for radio buttons */
.radio-group input[type="radio"]:checked {
  border-color: #007cba;
  background-color: #007cba;
  box-shadow: 0 0 5px rgba(0, 124, 186, 0.5);
}

/* Criterion 18: Change label text color when radio is selected */
.radio-group input[type="radio"]:checked + label {
  color: blue;
}

/* Textarea specific */
textarea {
  resize: vertical;
  min-height: 100px;
}

/* Button styling */
.submit-btn {
  width: 25%;
  padding: 12px;
  background-color: #007cba;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
}

/* Criterion 14: :hover pseudo-class for button */
.submit-btn:hover {
  background-color: #005a8d;
  box-shadow: 0 0 8px rgba(0, 124, 186, 0.6);
}

button:hover {
  background-color: orange;
}

/* Responsive design */
@media (max-width: 480px) {
  .radio-group label {
    margin-bottom: 15px;
  }
  
  .container {
    padding: 20px;
  }
  
  .submit-btn {
    width: 100%;
  }

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Job Application Form - Build a Job Application Form

do you think this will select your labels?

they are not siblings to input elements, are they?

1 Like

Ok, so I’ve changed the css, so that the text also turns blue when the radio button is clicked. Despite working, criteria 18 is not solved when I run the tests.

Here is the code:

.radio-group label:has(input[type=“radio”]:checked) {

color: blue;

}

now you need to remove this

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.