Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

Floating an image inside colour div bkground

This is a discussion on "Floating an image inside colour div bkground" within the Web Page Design section. This forum, and the thread "Floating an image inside colour div bkground are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Aug 30th, 2006, 11:38
Junior Member
Join Date: Aug 2006
Location: Lancashire, UK
Age: 28
Posts: 36
Thanks: 3
Thanked 0 Times in 0 Posts
Floating an image inside colour div bkground

Hi,

I wanted to make elements on a site more prominent by adding a background colour and border (creating a box) as a sort of feature. When I add an image into this 'feature' box and float it so it appears to the left if the image is longer than the text content in the box it overlaps the bottom of the box. I've tried to illustrate this below....

STYLE:
#feature {
background-color:#EEEEEE;
border:1px solid #D7D7D7;
padding:10px;
}
.floatL {
float:left;
padding:0px 10px 0px 0px;
}

CODE:
<div id="feature">
img src="#.jpg" alt="#" width="80" height="61" border="0" class="floatL">
<p>Text content....</p>
</div>

Painfully simple I know , I'd be glad for any advice, Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old Aug 30th, 2006, 14:49
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Floating an image inside colour div bkground

Floated elements are not in the normal document flow. And thus it will overlap the box if the image is taller than the content. a quick fix would be to do something like:

.clearing {height:0; clear:both;}

<div id="feature">
img src="#.jpg" alt="#" width="80" height="61" border="0" class="floatL">
<p>Text content....</p>
<div class="clearing">&nbsp;</div>
</div>
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 30th, 2006, 21:29
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Floating an image inside colour div bkground

You can also specify an exact height for #feature by adding this to its properties:

height: 71px;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Aug 31st, 2006, 09:22
Junior Member
Join Date: Aug 2006
Location: Lancashire, UK
Age: 28
Posts: 36
Thanks: 3
Thanked 0 Times in 0 Posts
Re: Floating an image inside colour div bkground

Brill, Thanks guys.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
floating, image, inside, colour, div, bkground

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Floating over text ihateasp Web Page Design 8 Dec 18th, 2007 09:16
[SOLVED] positioning something inside an image danny322 Web Page Design 3 Dec 5th, 2007 14:36
Floating with an image between columns? oya Web Page Design 2 Aug 27th, 2006 12:08
floating problems... gogogadgetearl Web Page Design 0 Jul 16th, 2005 05:25
Floating Without tables jcschott Web Page Design 3 Apr 19th, 2005 17:22


All times are GMT. The time now is 19:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8