Back to Freecodecamp

Step 16

curriculum/challenges/english/blocks/workshop-game-settings-panel/68f16192e8a66f3b948d3ebd.md

latest4.8 KB
Original Source

--description--

To finish setting up the visual effect of your checkbox, set the font-weight property with a value of bold. This will increase the visibility of the checkmark.

Now that this is easier to see, change the color to a value of white. This is going to change the color of the checkmark within the checkbox when it is checked.

Lastly, alter the line-height to a value of 20px.

With that, you have completed the game settings panel!

--hints--

You should add a font-weight property to your combined type selector with a pseudo-class selector and pseudo-element selector of input[type="checkbox"]:checked::after.

js
assert.isNotEmpty(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.fontWeight);

You should have a font-weight property with a value of bold.

js
assert.strictEqual(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.fontWeight, "bold");

You should add a color property to your combined type selector with a pseudo-class selector and pseudo-element selector of input[type="checkbox"]:checked::after.

js
assert.isNotEmpty(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.color);

You should have a color property with a value of white.

js
assert.oneOf(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.color, ["white", "#ffffff", "rgb(255,255,255)"]);

You should add a line-height property to your combined type selector with a pseudo-class selector and pseudo-element selector of input[type="checkbox"]:checked::after.

js
assert.isNotEmpty(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.lineHeight);

You should have a line-height property with a value of 20px.

js
assert.strictEqual(new __helpers.CSSHelp(document).getStyle('input[type="checkbox"]:checked::after')?.lineHeight, "20px");

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Game Settings Panel</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div class="settings-card">
      <h1>Game Settings</h1>
      <label> <input type="checkbox" />Sound Effects</label>
      <label> <input type="checkbox" />Background Music</label>
      <label> <input type="checkbox" />Hard Mode</label>
      <label> <input type="checkbox" />Haptic feedback</label>
    </div>
  </body>
</html>
css
body {
  height: 100vh;
  background-color: #f0f0f0;
  text-align: center;
}

.settings-card {
  max-width: 250px;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin: auto;
  text-align: left;
}

h1 {
  text-align: center;
}

label {
  display: block;
  cursor: pointer;
  margin: 8px auto;
}

input[type='checkbox'] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  appearance: none;
  border: 2px solid #f1be32;
  border-radius: 4px;
  background-color: white;
  transition: all 0.3s;
  vertical-align: middle;
  margin-right: 15px;
}

input[type='checkbox']:checked {
  background-color: #f1be32;
  border-color: #e2a60d;
}

input[type="checkbox"]:checked::after {
  content: "✓";
  display: block;
  text-align: center;
--fcc-editable-region--
  
--fcc-editable-region--
}

--solutions--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Game Settings Panel</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div class="settings-card">
      <h1>Game Settings</h1>
      <label> <input type="checkbox" />Sound Effects</label>
      <label> <input type="checkbox" />Background Music</label>
      <label> <input type="checkbox" />Hard Mode</label>
      <label> <input type="checkbox" />Haptic feedback</label>
    </div>
  </body>
</html>
css
body {
  height: 100vh;
  background-color: #f0f0f0;
  text-align: center;
}

.settings-card {
  max-width: 250px;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin: auto;
  text-align: left;
}

h1 {
  text-align: center;
}

label {
  display: block;
  cursor: pointer;
  margin: 8px auto;
}

input[type='checkbox'] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  appearance: none;
  border: 2px solid #f1be32;
  border-radius: 4px;
  background-color: white;
  transition: all 0.3s;
  vertical-align: middle;
  margin-right: 15px;
}

input[type='checkbox']:checked {
  background-color: #f1be32;
  border-color: #e2a60d;
}

input[type='checkbox']:checked:after {
  content: '✓';
  display: block;
  text-align: center;
  font-weight: bold;
  color: white;
  line-height: 20px;
}