image float:right works in firefox but not i.e.

Discussion in 'CSS' started by RogerDodgr, Apr 10, 2010.

  1. #1
    I have been staring at this for several hours. It is hard coded in drupal's image-attach module (via php), so changing the code can be done but is not easy. I don't know css, so let me ask...

    Does anything look wrong with this code? This is from view/source... It floats right if Firefox but does not float right in Internet Explorer.
    <div style="width: 150px" class="image-attach-teaser">
    	<a href="........">
    		<img src="http://.....JPG" 
    			alt="....." title="......"  
    				class="image image-thumbnail " width="150" height="112" />
    	</a>
    </div>
    
    Code (markup):
    
    .image-attach-teaser {
      float: right;
      float: top;
      margin-left: 1em;
    }
    
    Code (markup):

     
    Last edited: Apr 10, 2010
    RogerDodgr, Apr 10, 2010 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    There is no such thing as float:top - that error is probably making IE ignore the ENTIRE CSS declaration.

    Though if you have a class what do you need the inlined width for, get that **** the **** out of the markup, and that 'image' class is disturbing - what, that it's a IMG tag isn't enough to apply styling?

    Also, if you are going to use margin-left on a float:right, you may want to consider adding display:inline just because IE will often screw up and double margins around floats. Floats are inherently display:block and nothing you set for display can change that, but for some weird reason in IE display:inline trips a behavior change that prevents the double margin bug.

    Basically:
    
    .image-attach-teaser {
      float:right;
      display:inline;
      margin-left:1em;
    }
    
    Code (markup):
    Should fix you right up.
     
    deathshadow, Apr 10, 2010 IP
    RogerDodgr likes this.