views:

335

answers:

5

http://wilwaldon.com/ie7bug/test1.php

Notice the middle column, the images are supposed to float left, they do in every browser but IE7. I've never encountered this problem before and have no idea what's going on with it.

Any ideas that would point me in the right direction would be greatly appreciated, thank you.

UPDATE

If I delete width: 330px from #contentleft p the spotlights line up perfectly, but I ran into a new problem. The left column wraps the right column now. Ughh! IE7!!!

+1  A: 

From your question it is not clear what exactly you are trying to achieve to float the image left of the Heading and the paragraph or just left of the paragraph. Could you please attach images showing the desired result and what you consider the bug.

Ivo Sabev
http://imgur.com/dwSGz.jpgThanks!
wilwaldon
+1  A: 
subkamran
If you use IE8, you can use the IE8 Developer Tools to inspect elements and disable/change styles in real-time. By disabling the paragraph width, the image successfully floats left but the paragraph text drops below the image. Make sure to put IE8 in Compatibility Mode to emulate IE7.
subkamran
Been messing with the width: The problem is that it will need to be the same class for images and not images as the info in the spotlights are dynamically created.
wilwaldon
I've been playing with some markup and I can't get anything to work without explicitly figuring out if there's an image or not. If there was a way to make the margin on the image fill up the remaining height of the spotlight item, you'd be in business. Alternatively, if you can guarantee that the height of the spotlight is always the same, you can add a bottom margin to the image.If there's a field that contains an image in your data store, I'd just put a statement that outputs an additional class if there's an image.
subkamran
That's one of the problems, the spotlights are dynamic and will change heights. I've been messing with this for a while now and pretty much lost all my hair haha.
wilwaldon
A: 

Copy paste this in empty html and see how it works. Should fix all your issues. Fix the width of .box to match your needed width. It also works if div.left is empty and you don't have image there.

<div class="box">
    <div class="left">
        <img src="http://www.google.com/intl/en_ALL/images/logo.gif" />
    </div>
    <div class="right">
        <h2>Heading</h2>
        <p>Paragraph text</p>
    </div>
</div>



<style>
    .box {
        width: 600px;
        background: red;
        }
    .left {
        float: left;
        width: auto;
        }
</style>
Ivo Sabev
I think the problem is that if there is no left div, then your width for the right div is too short compared to others with images.
subkamran
Tried this solution as well. Still not working properly. It pretty much gets the same results as before.
wilwaldon
I tweaked it a bit, try with the new one.
Ivo Sabev
What happened to the .right class?
wilwaldon
You don't need it for the floats to work, still you can specify stuff there if you want.
Ivo Sabev
A: 

I don't like doing this, but this is a way to achieve the effect with IE7 using jQuery:

    $(function() {

        $(".spotlight .item img").each(function() {

            $(this).css("marginBottom", $(this).parent().height() - $(this).height());

        });

    });

See http://test.sua.umn.edu/test.kamran/ie7float.html

subkamran
A: 

You seem to be using display: table-cell to have the text appear in a column next to the floated image instead of wrapping around it.

You should be using overflow to achieve that effect:

.spotlight1 p { 
    color: #333333;
    font-size: 12px;
    overflow: hidden;
}

You'll have to get rid of the width on those paragraphs too, though, which they're now getting from the #contentleft p.

But you can use the same trick for the leftmost two columns altogether if you put the #inner2right2 div right before the #inner2left div. You can then use overflow on that left column to make them stay next to each other. That way you can get rid of the width you're setting on the #contentleft p too.

This will work in IE7 too.

I think it'll work in IE6 as well if you give those same blocks "layout". The easiest way to do that is by adding zoom: 1.

mercator
I just tried this solution and for some reason it's not working either. Maybe I'm doing the markup wrong? No idea, in theory this should work but it's being stubborn.Could you give me a markup example by chance to compare to?
wilwaldon
I don't have time now, but what isn't working? The version you've got up now seems to be working. The `display: table-cell` isn't necessary anymore, though.
mercator