It makes an element float to the left side of its container, similar to CSS float: left;.
Click to reveal answer
beginner
How do you clear floats in Bootstrap using utility classes?
Use the <code>.clearfix</code> class on a container to clear floated child elements, ensuring the container expands to contain them.
Click to reveal answer
beginner
What is the difference between .float-start and .float-end in Bootstrap?
.float-start floats an element to the left, while .float-end floats it to the right, respecting text direction.
Click to reveal answer
intermediate
Why is clearing floats important in web layouts?
Clearing floats prevents parent containers from collapsing when their child elements are floated, maintaining proper layout structure.
Click to reveal answer
intermediate
How does Bootstrap's <code>.clearfix</code> class work under the hood?
It uses a CSS pseudo-element ::after with content: "", display: table, and clear: both to clear floats.
Click to reveal answer
Which Bootstrap class floats an element to the right?
A.float-end
B.float-start
C.float-right
D.float-left
✗ Incorrect
.float-end floats elements to the right respecting text direction. .float-start floats left.
What is the purpose of the .clearfix class in Bootstrap?
ATo float elements
BTo add margin
CTo clear floated elements inside a container
DTo hide elements
✗ Incorrect
.clearfix clears floats so the container wraps floated children properly.
If you want an element to float left in Bootstrap, which class do you use?
A.float-end
B.float-start
C.float-left
D.float-clear
✗ Incorrect
.float-start floats elements to the left side.
What CSS property does .clearfix use to clear floats?
Aposition: relative
Bfloat: none
Cdisplay: none
Dclear: both
✗ Incorrect
.clearfix uses clear: both to clear floats.
Which of these is NOT a Bootstrap float utility class?
A.float-center
B.float-end
C.clearfix
D.float-start
✗ Incorrect
Bootstrap does not have a .float-center class.
Explain how to use Bootstrap float utilities to position elements and why clearing floats is necessary.
Think about how floating affects layout and how Bootstrap helps manage it.
You got /4 concepts.
Describe what happens visually when you apply .float-start to an element and do not clear the float in its container.
Imagine a box inside a container that shrinks unexpectedly.
You got /4 concepts.
Practice
(1/5)
1. What does the Bootstrap class float-start do to an element?
easy
A. It floats the element to the right side of its container.
B. It centers the element horizontally.
C. It floats the element to the left side of its container.
D. It clears any floating elements before it.
Solution
Step 1: Understand float-start meaning
The class float-start in Bootstrap floats an element to the start side of the container, which is left in left-to-right languages.
Step 2: Compare options with float-start behavior
The float-start class floats the element to the left side of its container. This matches 'It floats the element to the left side of its container.' Other options describe floating right, centering, or clearing floats.
Final Answer:
It floats the element to the left side of its container. -> Option C
Quick Check:
float-start = float left [OK]
Hint: float-start always means float left in LTR layouts [OK]
Common Mistakes:
Confusing float-start with float-end
Thinking float-start centers the element
Mixing float with clear utilities
2. Which of the following is the correct Bootstrap class to clear floats on an element?
easy
A. clearfix
B. float-clear
C. clear-fix
D. clear-start
Solution
Step 1: Recall Bootstrap clear utility class
Bootstrap uses the class clearfix to clear floats and prevent wrapping issues.
Step 2: Check options for correct spelling and usage
clearfix is the correct class name. The other options like float-clear, clear-fix, and clear-start do not exist in Bootstrap.
Final Answer:
clearfix -> Option A
Quick Check:
Clear floats = clearfix [OK]
Hint: Remember: clearfix clears floats, float-clear is not valid [OK]
Common Mistakes:
Using float-clear instead of clearfix
Misspelling clearfix as clear-fix
Confusing float and clear classes
3. What will be the visual layout result of this HTML snippet?
The parent div collapses in height due to floated children. What should be added?
medium
A. Add clear-start to Content Box.
B. Add float-end to Content Box.
C. Add float-start to Content Box as well.
D. Add clearfix class to the parent <div>.
Solution
Step 1: Understand float-start effect on Left Box
The float-start on Left Box and float-end on Content Box take both children out of normal flow, causing the parent container to collapse.
Step 2: Use clearfix to fix float overlap
Adding clearfix to the parent container clears floats, forcing it to expand and contain the floated children properly.
Final Answer:
Add clearfix class to the parent <div>. -> Option D
Quick Check:
Clear floats with clearfix on parent [OK]
Hint: Use clearfix on parent to fix float overlap [OK]
Common Mistakes:
Adding float classes to non-floated elements
Using non-existent clear-start class
Not clearing floats causing layout break
5. You want two boxes side by side: the first floats left, the second should not wrap around it but appear below. Which Bootstrap classes should you use?
hard
A. First box: float-start, second box: clear-start
B. First box: float-start, second box: clearfix
C. First box: float-start, second box: clear-fix
D. First box: float-start, second box: clear-start (Note: clear-start is not a Bootstrap class)
Solution
Step 1: Float first box left with float-start
The first box uses float-start to float left as required.
Step 2: Prevent second box wrapping with clearfix
To stop the second box from wrapping around the floated first box, apply clearfix to the second box or its container to clear the float.
Final Answer:
First box: float-start, second box: clearfix -> Option B
Quick Check:
Use clearfix to clear floats below floated elements [OK]
Hint: Clear floats with clearfix to avoid wrapping [OK]
Common Mistakes:
Using clear-start which is not a Bootstrap class
Misspelling clearfix as clear-fix
Not clearing floats causing wrapping
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.