CSS for Web Development

0% completed

Previous
Next
Quiz
Question 1
What is the primary purpose of the CSS float property?
A
To change the text color of an element.
B
To center an element horizontally within its container.
C
To remove an element from the normal document flow and position it to the left or right of its container.
D
To fix an element's position relative to the viewport.
Question 2
In the context of floating elements, what does the clear property do?
A
It specifies the color of the floating element.
B
It removes the float from an element.
C
It defines the width of the floating element.
D
It specifies on which sides an element can not be adjacent to floated elements.
Question 3
What will happen to the following
when rendered in the browser?
<style>
  .container {
    width: 500px;
    border: 1px solid #000;
  }
  .box {
    float: left;
    width: 200px;
    height: 100px;
    background-color: #f00;
    margin: 10px;
  }
</style>

<div class="container">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>
A
All three boxes will stack vertically within the container.
B
The first two boxes will float left, and the third will wrap to the next line due to insufficient space.
C
All three boxes will float left on the same line, overflowing the container.
D
The boxes will not be displayed because they exceed the container's width.

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next