views:

423

answers:

3

Hey,

lately i've been slamming my head against my desk to solve this Problem. Didn't work out. I know it can be solved by editing the contents with some clearing elements. Sadly there is some javascript sorting beeing used and the Sourcode is being generated by CMS Components so that would be my last shot.

I'm having a few boxes beeing floated alwayes 2 in a row. The boxes have a diffrent height but equal width and are all placed in a container with static width. The link shows the source i need to reproduce the Problem. My Boxes are beeing floated left. I tried to fix this with clear: left on odd and clear: right on even elements. But that only works in ff/ie8/chrome Browsers, not ie7.

Example: http://www.i3rutus.de/ie7divfloatexample/

Anyone knows a possibility to fix this Problem by just editing the CSS not the actual XHTML? Problem appears in IE7. IE8, Chrome and FF work fine.

Any Ideas?

Thanks in advance

A: 

If you are able to include a js in the header then maybe try to use http://code.google.com/p/ie7-js/?

I played with it but given float:right screws it up, it's probably a little more complex than experimenting with float values.

-- update --

I seemed to be able to get it work in ie7 by:

remove float:left on .clear, added float:left;margin-top:0px to .even

coolnalu
A: 

Just remove

.even {
    clear: left;
}
.odd {
    clear: right;
}

and it works as intented.

BalusC
A: 

Here's the deal. You only need to float one of each of the pairs of boxes. Here's the amended css rules:

  .even {
  float: left;
  clear: left;
  margin-top: 0
  }

  .odd {            
  }

Demo

(Incidentally, your use of odd and even had me chasing my tail for a while ;) )

graphicdivine
Sorry for the odd and even thing, my mistake. Your solution works fine in ie7, not in ie8 and ff as i realized. So i can use it in my browser specific styles.Thank you very much.
i3rutus