📖 Scenario: You are creating a simple webpage layout using Bootstrap. You want to arrange three columns in a row, but you want the second column to appear first on the screen, the first column to appear second, and the third column to appear last.
🎯 Goal: Build a Bootstrap row with three columns. Use Bootstrap's column ordering classes to reorder the columns so that the second column appears first, the first column appears second, and the third column appears last on all screen sizes.
📋 What You'll Learn
Use Bootstrap 5 classes for layout and ordering
Create a row with three col elements
Apply Bootstrap order classes to reorder columns as specified
Ensure the HTML structure is valid and semantic
💡 Why This Matters
🌍 Real World
Web developers often need to reorder content visually without changing the HTML structure. Bootstrap's column ordering helps create flexible, responsive layouts.
💼 Career
Understanding Bootstrap grid and column ordering is essential for front-end developers building responsive websites and user interfaces.
Progress0 / 4 steps
1
Create the Bootstrap row with three columns
Write the HTML code to create a div with class row. Inside it, create three div elements each with class col. The first column should contain the text Column 1, the second column Column 2, and the third column Column 3.
Bootsrap
Hint
Use a div with class row to hold the columns. Each column is a div with class col.
2
Add Bootstrap order classes to columns
Add Bootstrap order classes to each column div to prepare for reordering. Add order-2 to the first column, order-1 to the second column, and order-3 to the third column.
Bootsrap
Hint
Use Bootstrap's order-* classes to set the order of each column.
3
Wrap the row in a container
Wrap the existing rowdiv inside a div with class container to center the content and add horizontal padding.
Bootsrap
Hint
Use a div with class container around the row.
4
Add Bootstrap CSS link in the head
Add the Bootstrap 5 CSS CDN link inside the <head> section of your HTML document to enable Bootstrap styles.
Bootsrap
Hint
Use the official Bootstrap 5 CSS CDN link inside the <head> tag.
Practice
(1/5)
1. What does Bootstrap's .order-* class do in a grid layout?
easy
A. It adds padding inside columns.
B. It changes the visual order of columns without altering the HTML structure.
C. It hides columns on smaller screens.
D. It changes the background color of columns.
Solution
Step 1: Understand the purpose of .order-* classes
Bootstrap's .order-* classes let you rearrange columns visually without changing their HTML order.
Step 2: Compare with other options
The other options describe unrelated styling or behavior, not column ordering.
Final Answer:
It changes the visual order of columns without altering the HTML structure. -> Option B
Quick Check:
Column ordering = Visual reorder without HTML change [OK]
Hint: Remember: .order-* changes visual order, not HTML order [OK]
Common Mistakes:
Thinking .order-* changes HTML structure
Confusing order with visibility or color
Assuming it affects padding or margins
2. Which of the following is the correct syntax to make a column appear first using Bootstrap classes?
easy
A. class="col order-last"
B. class="col order-1"
C. class="col order-0"
D. class="col order-first"
Solution
Step 1: Recall Bootstrap order classes
Bootstrap provides order-first to place a column first, order-last to place last, and numeric order-* from 0 to 12 for custom order.
Step 2: Analyze each option
class="col order-1" uses order-1 which is not guaranteed first. class="col order-first" uses order-first which explicitly places the column first. class="col order-0" uses order-0 which is valid but less clear than order-first. class="col order-last" places the column last.
Final Answer:
class="col order-first" -> Option D
Quick Check:
Use order-first to place column first [OK]
Hint: Use order-first to make a column appear first easily [OK]
Lower order numbers appear first visually. Here, B has order-1, C order-2, A order-3.
Step 2: Arrange columns by order
Order from smallest to largest: B (1), C (2), A (3).
Final Answer:
B, C, A -> Option A
Quick Check:
Order numbers ascending = B, C, A [OK]
Hint: Lower order-* number means earlier visual position [OK]
Common Mistakes:
Assuming HTML order is visual order
Mixing up order numbers and column content
Ignoring that order-1 is before order-2
4. You want the second column to appear first on small screens but keep original order on larger screens. Which class should you add?
medium
A. order-lg-first
B. order-first
C. order-sm-first
D. order-last
Solution
Step 1: Understand responsive order classes
Bootstrap uses breakpoint prefixes like sm, md, lg to apply order changes at specific screen sizes.
Step 2: Match requirement to class
To reorder only on small screens, use order-sm-first. order-first applies to all sizes. order-lg-first applies on large screens. order-last places last always.
Final Answer:
order-sm-first -> Option C
Quick Check:
Use order-sm-first for small screen reorder [OK]
Hint: Use order-sm-first to reorder only on small screens [OK]