Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:

Advertise Here

CSS Library: Image CSS: Here

Floating image with no text wrap

Author: Dynamic Drive

By default, floating an image causes the surrounding text to wrap around it, such in in the below example:

A safari park is a large nature reserve intended for safari tours and encounters with rare wildlife. They are common in Africa, but many exist elsewhere, including popular parks in England. People who wish to see animals in their natural state will love a trip to the safari.

However, sometimes you may want a different effect whereby the image floats, yet the surrounding content do NOT wrap around the image. This can be accomplished through the familiar "float" attribute, combined with "margins", while taking into account IE'6 dreadful "3px text-jog bug". The result is:

A safari park is a large nature reserve intended for safari tours and encounters with rare wildlife. They are common in Africa, but many exist elsewhere, including popular parks in England. People who wish to see animals in their natural state will love a trip to the safari.

The CSS:

The HTML:

Code Info

Rate this code:

Date Posted: 05/02/2006

Revision History: None

Usage Terms: Click here

Your Comments (71)

Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.

Comment Pages 3 of 7 pages  <  1 2 3 4 5 >  Last »

May I know about Flash Buttons for linking in HTML another pages
Posted by Linn Htet Aung on 05/09, 12:56 AM
Great examples, thank you so much
Posted by Home Window Security on 05/23, 11:37 AM
css textboxt ınput (textfield) style - examples - -
http://www.css-lessons.ucoz.com/textbox-css-examples.htm
Posted by chester.. on 05/23, 09:13 PM
Great, simple piece of code.
Posted by Hamisi Malipula on 06/13, 02:52 AM
Thank you very much!It's great!
Posted by Ntiniw on 07/23, 05:02 AM
my picture wont show up. anyone wanna tell me whyy ?
Posted by madison on 08/01, 06:43 AM
can this code put on blog..?
Posted by marewa on 08/01, 08:49 AM
Hello,
This solution doesn't work with Internet Explorer 6, So you can write:
p {display:inline-block;}
I advise to specify this rule for IE6 so you can write :
*p {display:inline-block;} (Add a star before the html tag)

You need to use the two rules. On the hand for FF and all other browser, on the other hand for IE6. So the declare them 2 in your CSS file.


johan


>>It's not very useful, because if you dont't have >>image it's still left free space.

>>Simple solution:
>>p {display:table; height:1%}
Posted by Johan on 08/01, 02:01 PM
I solved this problem in a manner most people wouldn't try, but is actually very easy to apply (I rhyme like gangsta). I simply added display: table-cell in CSS to the div containing the text on the right. However, I'm not sure of it's cross-browser compatibility.
Posted by Brayden W on 08/03, 11:22 AM
very useful.It really works perfectly.
it just takes few minutes to align.Thank you.
Posted by b.berry on 09/05, 11:56 PM

Comment Pages 3 of 7 pages  <  1 2 3 4 5 >  Last »

Commenting is not available in this weblog entry.
Copyright 2006-2011 Dynamic Drive Read our Usage Terms before using any of the CSS codes.