Weldon Johnson
Weldon Johnson

Reputation: 183

Float a Div Next to a Table

I'm trying to have a div that will hold my ad and float to the right of the page. I want the table and text in the main body to be to the left of the ad and then extend all the way to the right of the page when the ad ends.

The problem is there is a table in the main body and it will not display to the left of the div. It displays below it. How do I fix this?

<p> 
    <div style="margin:5px; float:right;">
        <img src="ad.jpg" height="600" width="160">
    </div>         
    blah blah blah
    <table width="100%">
        <tr><td>dsf</td></tr>
    </table> 
    the table because of the 100% appears below the div 
    for the ad.jpg instead of to the left of it
</p>

Upvotes: 1

Views: 9868

Answers (2)

giorgio79
giorgio79

Reputation: 4189

Add display:inline css for the table!

Upvotes: 5

Muhammad Raheel
Muhammad Raheel

Reputation: 19882

Enclose the table in another div and use clear property in the first div

Upvotes: 1

Related Questions