What does floating an element do in CSS ? How do you float an element?


The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow.

We can float an element by using the float property:-

(1) left :- The element must float on the left side of its containing block.

(2) right:- The element must float on the right side of its containing block.

(3) none :- The element must not float.

(4) inherit :- The element inherits the flow value of its parent.


How Elements Float

A floated element is taken out of the normal flow and shifted to the left or right as far as possible in the space available of the containing element.

img { float: left; }


Share to whatsapp

More Questions from Web Technology and its Applications Module 2

Explain Positioning Elements in CSS?
(or)
Explain the different ways of position Elements In CSS layout techniques
View
What is Responsive Design? Explain the components that make responsive web design. Why its important ? explain in detail.
View
Types of list in HTML (Unordered List , Ordered List , Nested Lists, Definition Lists)
View
Discuss <table> element along row spanning and column
View
Frames in HTML
View
Approaches to CSS Layout .
Explain fixed Layout and Liquid Layout with example each. List liquid and Fixed layout Advantages and limitations.
View
Compare/Difference between radio button and checkbox controls of HTML 5 with Examples.
View