0
0
Bootsrapmarkup~20 mins

Checkboxes and radios in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Checkboxes and Radios Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the purpose of the name attribute in a group of radio buttons?
In Bootstrap forms, why do all radio buttons in the same group share the same name attribute?
AIt makes the radio buttons larger and easier to click.
BIt disables all radio buttons in the group.
CIt styles the radio buttons with Bootstrap colors.
DIt groups the radio buttons so only one can be selected at a time.
Attempts:
2 left
💡 Hint
Think about how radio buttons behave when grouped.
📝 Syntax
intermediate
2:00remaining
Which option correctly creates a Bootstrap styled checkbox?
Select the correct Bootstrap 5 checkbox code snippet that will render a checkbox with label "Subscribe".
A
<div class="checkbox">
  <input type="checkbox" id="subscribeCheck">
  <label>Subscribe</label>
</div>
B
<div class="form-check">
  <input class="form-check-input" type="checkbox" id="subscribeCheck">
  <label class="form-check-label" for="subscribeCheck">Subscribe</label>
</div>
C
<input type="checkbox" class="checkbox" id="subscribeCheck">
<label for="subscribeCheck">Subscribe</label>
D
<div class="form-group">
  <input type="checkbox" class="form-control" id="subscribeCheck">
  <label for="subscribeCheck">Subscribe</label>
</div>
Attempts:
2 left
💡 Hint
Bootstrap checkboxes use form-check and form-check-input classes.
rendering
advanced
2:00remaining
What will be the visual result of this Bootstrap radio button code?
Given the following code, what will the user see in the browser?
Bootsrap
<div class="form-check">
  <input class="form-check-input" type="radio" name="colorOptions" id="redOption" value="red" checked>
  <label class="form-check-label" for="redOption">Red</label>
</div>
<div class="form-check">
  <input class="form-check-input" type="radio" name="colorOptions" id="blueOption" value="blue">
  <label class="form-check-label" for="blueOption">Blue</label>
</div>
ATwo radio buttons labeled 'Red' and 'Blue', with 'Red' selected by default.
BTwo checkboxes labeled 'Red' and 'Blue', both unchecked.
CTwo radio buttons labeled 'Red' and 'Blue', both selected.
DA dropdown menu with options 'Red' and 'Blue'.
Attempts:
2 left
💡 Hint
Look at the type and checked attributes.
selector
advanced
2:00remaining
Which CSS selector correctly targets only checked Bootstrap checkboxes?
You want to style only the checkboxes that are checked in a Bootstrap form. Which CSS selector will do this?
Ainput.form-check-input[type="checkbox"]:checked + label.form-check-label
Binput[type="checkbox"]:checked
C.form-check-input:checked
Dlabel.form-check-label:checked
Attempts:
2 left
💡 Hint
Remember the label is a sibling after the input.
accessibility
expert
2:00remaining
Which practice improves accessibility for Bootstrap radio buttons?
To make Bootstrap radio buttons accessible for screen readers and keyboard users, which practice is best?
AWrap radio inputs inside <code>div</code> without labels and use placeholder text.
BAdd <code>aria-hidden="true"</code> to all radio inputs.
CUse <code>label</code> elements with <code>for</code> attributes matching the input <code>id</code>.
DUse only colors to indicate which radio button is selected.
Attempts:
2 left
💡 Hint
Think about how screen readers identify form controls.