0

For my webpage I want to set up columns (boxes). For example I have an image floating to the left then I want to float another image or a plain box underneath the image.

This is my HTML code

    <div style="float: left; background-color: white;">
    <img src="Images/Books.jpg" alt="Books" width="225" height="125"/>
    </div>

    <div id="left-col">some text</div>

My image is floating left and I want my left column to float underneath it. I tried using the <br> tag but if I want to include a center column the <br> would not work...

This is my CSS code

#left-col 
 {
position: ;
float: left;
height: 300px;
width:225px;
background-color: white;
margin-bottom: 10px;
}
2
Contributors
2
Replies
19
Views
4 Years
Discussion Span
Last Post by Monkey101
0
    <div style="float: left; background-color: white;">
    <img src="Images/Books.jpg" alt="Books" width="225" height="125"/>
    </div>

    <div class="clear: both;">&nbsp;</div>

    <div id="left-col">some text</div>
0

I am confused by the clear property. I know clear: both; will not allow floating elements on either the right and left side. I applied it to my code to see if it worked (which it did).
Then I added another column and centered it

    <div style="float: left; background-color: white; ">
    <img src="Images/Books.png" alt="Books" width="225" height="125"/>
    </div>

    <div id="central-col">some text</div> 

    <div id="left-col" style="clear: both;">some text</div>

In order for my centered column not be affected is placing it above

<div id="left-col" style="clear: both;">some text</div>

why is that?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.