Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2009, 03:57 AM   PM User | #1
trex1t
New to the CF scene

 
Join Date: Jun 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
trex1t is an unknown quantity at this point
floated image outsive of div

Hi guys, noob question, but when I saw this it broke some of the rules I thought I had known.

I want to float my image to the right and have paragraph text wrap around it. I do not know why the image is outside of my #main div with the gray background and darkblue border, but I don't want it to be. Relative code below.

www.gowithjon.com/aboutme.html

<div id="main">
<h2> About myself <h2>
<hr>

<img src="img/aboutme/me.jpg" style="position: relative; float: right">

<p>...</p>

</div>

*I don't think position: relative is necessary, but not having it doesn't change anything.

#main {
position: relative;
top: -20px;
background: #EAF3F8;
border: 20px #153e56 solid;
margin: 0px 50px;
width: 60%;

}

Thanks all
trex1t is offline   Reply With Quote
Old 07-24-2009, 07:43 AM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
It's because the <img> is floated, so #main doesn't extend to the bottom of it (although it does in IE, technically incorrectly). Try adding overflow:auto to #main - this will clear your float and extend #main.
SB65 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:34 PM.


Advertisement
Log in to turn off these ads.