0
0
Bootsrapmarkup~20 mins

Form layout (inline, horizontal) in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Form Layout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
Identify the inline form layout
Which option correctly renders a Bootstrap inline form where inputs and labels appear side by side on the same line?
A
<form>
  <div class="form-group">
    <label for="email">Email:</label>
    <input type="email" class="form-control" id="email" placeholder="Enter email">
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
B
<form class="form-inline">
  <label for="email" class="mr-2">Email:</label>
  <input type="email" class="form-control mr-2" id="email" placeholder="Enter email">
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
C
<form>
  <div class="form-group row">
    <label for="email" class="col-sm-2 col-form-label">Email:</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="email" placeholder="Enter email">
    </div>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
D
<form class="form-horizontal">
  <div class="form-group">
    <label for="email" class="control-label col-sm-2">Email:</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="email" placeholder="Enter email">
    </div>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
Attempts:
2 left
💡 Hint
Look for the class that makes form elements appear side by side in Bootstrap.
selector
intermediate
1:30remaining
Bootstrap class for horizontal form labels
In a Bootstrap horizontal form, which class is used to align labels to the right side of their grid column?
Atext-right
Btext-left
Ctext-center
Dtext-justify
Attempts:
2 left
💡 Hint
Think about how to align text to the right in Bootstrap.
🧠 Conceptual
advanced
2:00remaining
Accessibility in inline forms
Which practice improves accessibility for screen readers in a Bootstrap inline form?
AUse <code>aria-label</code> on inputs without visible labels
BRemove labels to save space since inputs have placeholders
CUse only placeholders as labels for inputs
DUse <code>aria-hidden="true"</code> on all labels
Attempts:
2 left
💡 Hint
Screen readers need clear labels even if not visible.
📝 Syntax
advanced
2:30remaining
Correct Bootstrap horizontal form structure
Which option correctly uses Bootstrap classes to create a horizontal form group with label and input aligned side by side?
A
&lt;div class="form-group"&gt;
  &lt;label for="name" class="col-sm-3"&gt;Name&lt;/label&gt;
  &lt;input type="text" class="form-control col-sm-9" id="name" placeholder="Enter name"&gt;
&lt;/div&gt;
B
&lt;div class="row form-group"&gt;
  &lt;label for="name" class="col-form-label col-sm-3"&gt;Name&lt;/label&gt;
  &lt;input type="text" class="form-control col-sm-9" id="name" placeholder="Enter name"&gt;
&lt;/div&gt;
C
&lt;div class="form-group row"&gt;
  &lt;label for="name" class="col-sm-3 col-form-label"&gt;Name&lt;/label&gt;
  &lt;div class="col-sm-9"&gt;
    &lt;input type="text" class="form-control" id="name" placeholder="Enter name"&gt;
  &lt;/div&gt;
&lt;/div&gt;
D
&lt;div class="form-group row"&gt;
  &lt;label for="name" class="col-sm-3 control-label"&gt;Name&lt;/label&gt;
  &lt;input type="text" class="form-control col-sm-9" id="name" placeholder="Enter name"&gt;
&lt;/div&gt;
Attempts:
2 left
💡 Hint
Bootstrap horizontal forms use a row container with label and input in separate columns.
layout
expert
3:00remaining
Responsive behavior of Bootstrap inline forms
What happens to a Bootstrap inline form on very small screens (e.g., mobile) if no responsive classes are added?
AForm controls remain inline and may overflow horizontally causing scroll
BForm controls automatically resize to fit horizontally without overflow
CForm controls disappear due to lack of responsive classes
DForm controls stack vertically because inline forms collapse on small screens
Attempts:
2 left
💡 Hint
Consider how inline elements behave on narrow viewports without special classes.