Jump to content

clear single float


jcombs_31

Recommended Posts

I have a left column that is floated left. Then I have an image in teh main body that is floated left so that the text will wrap.  I need to clear the image float, and not the left column float.  How can this be done?  If I clear left for my next element, it clears the entire left column which is not what I want.
Link to comment
Share on other sites

I hope I am not insulting you with this solution, but one way to accomplish what I think you are after is to display your text as a block element. Try this. . .

[b]CSS[/b]
#left{float:left;}
#img{float:left;}
#text{display:block;}

[b]HTML[/b]
<div id="left">

</div>

<div id="main">
    <img src="images/cart_sm.png" />
    <div id="text">Hello, this is some text. Hope it works.</div>
</div>
</body>

If you don't want to introduce another division, use <p></p> around your text since paragraphs are block elements be default.

RyanOD
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.