Jump to content

Image into a Div


Norman

Recommended Posts

Hello guys and gals, I have this CSS code:

.dcontent {border: 1px solid #0099FF;padding: 15px;margin-top: 25px;margin-right: 25px;margin-left: 295px;}

And this HTML:

<div class="dcontent"><div style="float: right"><img src="imgs/money_image.gif"  /></div>Test</div>

And I get this:http://img213.imageshack.us/img213/8152/blablans5.jpgWhy? Can you please help me?

Link to comment
Share on other sites

Use this HTML:

<div class="dcontent"><div style="float: right"><img src="imgs/money_image.gif"  /></div>Test<div style="clear: both"></div></div>

Link to comment
Share on other sites

Ingolme's suggestion is correct.The idea of using a DIV to clear the floats (<div style="clear: both"></div>) is to kind of 'cancel' them. I remember I used a table as a wrapper on a website once before I knew about this, the website was already up and running so I didn't change it... but I learned :) Now, a tip to optimize your CSS:

.dcontent {border: 1px solid #0099FF;padding: 15px;margin: 25px 25px 0 295px; /*top - right - bottom - left*/}

Hope this helps.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...