Hi All,

Been using panels for a front page layout and it's worked fine in IE6 and Firefox, but now it messes up in IE7, shifting the right column below the other 2 (left and middle).

You can see the site at http://aboutupstream.com

Any thoughts on how the CSS code below should be improved for IE 7 (while not breaking in the others ;) )


.panel-3col-stacked { 
  /* border: 1px solid red; */ 
  overflow: hidden; 
}
.panel-3col-stacked div div { 
  margin: .5em;
}
.panel-3col-stacked .panel-col-top,
.panel-3col-stacked .panel-col-bottom { 
  width: 100%; 
  clear: both;
}
.panel-3col-stacked .panel-col-first { 
  float: left; 
  width: 22%; 
}
.panel-3col-stacked .panel-col { 
  float: left; 
  width: 50%; 
}
.panel-3col-stacked .panel-col-last { 
  float: right; 
  width: 22%; 
}

Thanks,

Alex

Comments

nimd4’s picture

Here, just add this to the very top of your index.php

if (stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
echo('HTTP_USER_AGENT identified as MSIE');
exit();
}

No more MSIE (problems)! :P :D

vm’s picture

for those who don't understand the joke above. If that code is added, all IE browsers won't be able to access the site. Thus do not use, unless you want this effect.

ALT83’s picture

Yes I got it :)

Trouble is, being a corporate site and targeting predominantly Asian users (both of which primarily use IE), I can't really afford to do that...

Or maybe I could, and strike one for the FF home team ;)

nimd4’s picture

Yeah, thanks. Guess I should've made it clearer..:)

kbourne’s picture

I've heard that IE doesn't like em for some reason (haven't investigated why) and I also got a tip at some point to use decimal points for the widths that add up to 99.9% for IE. I've been so busy that I haven't had a chance to learn why these work, I just know that they get around some of the bugs in IE. I have a pretty long collection of these types of things that have to do with IE, much longer than Firefox...

So for the panels, I used 5px instead of .5em and for the 2 columns, I used 49.9% for both and 33.3% for the 1/3 column stacked, and did similar stuff for the column widths in the other panel types. Seems to work. But can anyone save me a night of surfing the net for IE hack explanations and tell me why? And am I going to regret these changes by causing something else to not work? Those questions always seem to loom in the back of my head when I do anything with Drupal, but thanks to this supportive community, I've survived so far!

Hope I've helped. There was another post at http://drupal.org/node/100793 from early December that seems to be the same problem, and unfortunately they weren't able to get an answer. I'll post a link to this page from there in case people miss this one.

So my three column stacked looked like this, as an example (but you need to do similar for all of them):

.panel-3col-33-stacked div div { 
  margin: 5px;
}
.panel-3col-33-stacked .panel-col-top,
.panel-3col-33-stacked .panel-col-bottom { 
  width: 99.9%; 
  clear: both;
}
.panel-3col-33-stacked .panel-col-first { 
  float: left; 
  width: 33.3%; 
}
.panel-3col-33-stacked .panel-col { 
  float: left; 
  width: 33.3%; 
}
.panel-3col-33-stacked .panel-col-last { 
  float: left; 
  width: 33.3%; 
}
.panel-clearer {
  clear: both;
}

I wonder if 5px is the best, maybe a smaller size would be best. You can play around with that one to see what works with your specific site.

Keith Bourne
Adaptive Campus
www.adaptivecampus.com

ALT83’s picture

Thanks for your help.

I solved it in the end by shrinking the left and right columns and floating the one on the right to the right (kind of like my original code at the top of the post).

Perhaps IE7 behaves slightly oddly to padding...

bryansd’s picture

A week of agony trying to get my .links to not "float" every which way using IE6 finally solved. Thanks very much for the suggestion to using the 5px for margin. I can finally wake up in the morning without trying to figure this one out.

-Bryan
CMSReport

Edited: OK...still having problems. This is frustrating...

lenkkivihko’s picture

.panel-2col-stacked { 
  /* border: 1px solid red; */ 
  overflow: hidden; 
}

.panel-2col-stacked div div { 
  margin: 1px;
}

.panel-2col-stacked .panel-col-top,
.panel-2col-stacked .panel-col-bottom { 
  width: 99.9%; 
  clear: both;
}
.panel-2col-stacked .panel-col-first { 
  float: left; 
  width: 49%; 
}
.panel-2col-stacked .panel-col-last { 
  float: left; 
  width: 49%; 
}
.panel-clearer {
  clear: both;
}

Harjoituspäiväkirja - www.lenkkivihko.fi

pulpzebra’s picture

This is due to Internet Explorer 7 new revolutionary css rendering (TM). But ok, this is a known issue for any designer. Stacking columns at 50% + 50% means that two columns, in a perfect world, would simply touch on their internal side. However, browser computation of the 100% width might calculate a 100% width of, for instance 500, while the 50%, instead of 250, might be calculated at 251. The stacked columns would then collide and fall one below the other. Same story is true for N-columns layouts.

For this reason, I suggest to use non-filling values, letting some room for browser calculation defects and for a non-colliding, whereas not touching for a very small distance, that in most cases can be quietly tolerated.

clarke’s picture

Thanks, this really helped me out a lot. I love this awesome Drupal community!

-T.C.

enthusaroo’s picture

Dear Keith,

I have the same problem with the web site that I am currently developing for a NGO.

As I searched on Drupal and found this forum topic, I was hoping that your work-around would work. I edited the threecol_33_34_33_stacked.css file to match the one that you posted on here. I'm using Drupal 5.5 and also using the default Garland theme. Unfortunately, when I navigate to the site with IE 7 (the newest one), the right column is still being displayed below the left and middle columns.

Does anyone have another suggestion or workaround for this problem?

hoza’s picture

Heya.. I'm still digging into this myself, so I'll post some code when I figure out my particular problems more (still getting the hang of CSS layout myself, so I'm not swift at this.) However, I'm pretty sure it's the node titles in my theme's CSS that is messing things up for me.

Basically, looking around in the theme CSS file, I found .nodeTitle with a fixed width of 400, which means that my two panels -- each having node titles in their list views -- will force the width of the panel to be at least 800px, which will cause IE (6.0+ in my case) to wrap the right column down under the other one. Sucky. Firefox 2.x works fine, considering it's honoring the width percentages and doesn't wrap the column.

So, currently I'm working on adding some specific CSS to handle the .nodeTitle when it's inside the particular view (and thus, the panel.) Hopefully, this is the fix and there aren't other goofy things that will crop up -- although that's surely a given.

BTW, get the Firebug extension for Firefox and use it to muck around with various CSS settings in realtime to see where elements are and what changing them does... it rocks. "R0x0rz", even. :P

HTH,
--Hoza

hoza’s picture

Here's some code to follow up on the concept. This definitely worked great for me -- wish I could have the many hours of my life back that it took to uncover what the heck was happening! :/

I found the .nodeTitle references in my theme's style.css file and copied them, to be sure I'd be over-riding everything I needed to. For my case, until I make up a better solution (like adding a specific style for each Views page or something like that), I just modded the CSS file in "/sites/all/modules/panels/layouts/" to add specifications of the node titles like this:

.panel-2col-stacked .view .nodeTitle {
  padding: 6px 0px 2px 0px;
  line-height: 18px;
  width: auto; 
}

I mercifully cut out all the other stuff like font goodies, since you can add/remove as much of that stuff as you want. The relevant thing here for me was that in my theme, the .nodeTitle had a width of 400, so changing it here to "auto" allows IE to not be an irritant. Of course, you could do something more specific here if you really want total control over it, like doing a "nobreak" or whatever... but I just want the title to wrap inside the newly-shrunk node title space inside my Panels column. You could also dig deeper down the tree and have the left column titles different than the right -- you'd just do something like this to get more specific (I think):

.panel-2col-stacked .panel-col-first .view .nodeTitle {
  /* stuff */
  width: auto; 
}
.panel-2col-stacked .panel-col-last .view .nodeTitle {
  /* stuff */
  width: auto; 
}
/* etc... */

Of course, following this train of thought, you could also override other stuff in the views from here. Again though, I'm pretty sure there's a better way to do this, like using CSS for the specific Views or something, but I think this approach at least will work if you're simply trying to mod a particular Panel layout.

Hope this is clear. If nothing else, maybe it will help people discover their own solutions along this problem's lines. Also, maybe others will chime in with much better solutions and I can go back to lurking & learning. :D

Cheers,
--Hoza

big_ham’s picture

For me (two column layout) it was as simple as changing one width to 49% (from 50%)

.panel-2col-bricks .panel-col-last {
width:49.9% !important;
}