A multi-line text box for longer input like messages or comments.
Bootsrap
<textarea class="form-control" rows="4" placeholder="Write your message here"></textarea>
Sample Program
This example shows a simple contact form using Bootstrap form controls. It includes a text input for name, an email input, a textarea for message, and a submit button. Labels and ARIA labels improve accessibility.
A. A styled email input box with placeholder text and accessible label
B. A plain input box without any styling or placeholder
C. A button labeled 'Enter email'
D. An error because aria-label is invalid here
Solution
Step 1: Analyze the input element
The input is of type email, has the Bootstrap class form-control, a placeholder, and an ARIA label.
Step 2: Understand the visual and accessibility effects
The form-control class styles the input nicely. The placeholder shows faint text inside the box. The aria-label helps screen readers identify the input as 'Email address'.
Final Answer:
A styled email input box with placeholder text and accessible label -> Option A
5. You want to create a dropdown menu for selecting a country using Bootstrap. Which code snippet correctly applies Bootstrap form control classes and accessibility best practices?
hard
A. <select class="form-select" aria-label="Country selector"><option>USA</option><option>Canada</option></select>
B. <select class="form-control" aria-labelledby="country"><option>USA</option><option>Canada</option></select>
C. <select class="form-select" aria-label="Country selector"><option selected>Select country</option><option>USA</option><option>Canada</option></select>
D. <select class="form-control" aria-label="country"><option>USA</option><option>Canada</option></select>
Solution
Step 1: Identify correct Bootstrap class for dropdowns
Bootstrap uses form-select for styling select dropdowns, not form-control.
Step 2: Check accessibility and usability
Using aria-label="Country selector" provides an accessible name. Including a default option like Select country with selected guides users.
Step 3: Compare options
<select class="form-select" aria-label="Country selector"><option selected>Select country</option><option>USA</option><option>Canada</option></select> uses form-select, has an accessible label, and a default selected option, making it best practice.
Final Answer:
<select class="form-select" aria-label="Country selector"><option selected>Select country</option><option>USA</option><option>Canada</option></select> -> Option C