Home > UI/UX Development > CSS > CSS Wrap / Float Text around a DIV or Image

CSS Wrap / Float Text around a DIV or Image

By default, DIV element in HTML occupies the entire width available to it. That is to say that unless controlled, the default width of DIV is always 100%. As a result, DIV element pushes other elements in its way down.

If you control width of the DIV element (let’s say you make it 50%), although DIV will follow your command and occupy only 50% of width –but it will still not allow other elements to wrap around it. At times, we need to wrap text around a DIV. In such cases, CSS property float comes to our rescue. Float forces DIV to give space to other elements on its sides. Let’s see how to wrap text around a DIV.

 float property can have either left or right as value.

 

This Article is TAGGED in , , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">