Fixing a style sheet for IE 7 8 9

Hello,

I created an HTML5 CSS3 layout from scratch and it looks exactly how I want in Firefox 5, Safari 5.1 and Chrome 12 for Mac.
But when I use https://browserlab.adobe.com/ for the same browsers, it appears a little broken (footer in the middle, background repeat, sub menus visible).
That made me wonder if I could trust Adobe’s tool or not.

Then when I use browserlab or http://ipinfo.info/netrenderer/ to view it in IE, it’s totally broken (to be expected).
• In IE9 the radial background is missing, menus are not styled or rotated and thrown to the far right, main content appears below the sidebar and its width is not respected (strange because in an older version of my layout all displayed just fine in IE9)
• In IE8 some times it’s the same thing with sidebar list taking all the space, sometimes it’s just a black page.
• In IE7 if it’s not the black or white page, it’s worse than in IE8 with the main content being unreadable.

I use two JS, one that fixes many IE issues and the other that brings HTML5 tags support but they seem to conflict or at least to be responsible for the black pages.

I do hope that it in fact displays fine in mozilla and webkit. I’m worried about IE because I have no idea how to fix it and 13% of my visitors use it (not negligible).

I would greatly appreciate any help as this is blocking me from launching the site (which is already overdue).

http://protostype.free.fr/index-sitepointversion.php

UPDATE1: validated HTML5, CSS3 gives errors, not sure anything can be done about it
UPDATE2: I tried modernizr instead, not much difference :-\

Jeez… this is exhausting.
I’ve changed a bit the scrolling of the main content and the sidebar and tidied the IE fixes in the head.
It displays better in IE, not perfectly but I think it will be much easier now for you to find what to change in my CSS.
BTW now it displays better in IE8 than in IE9, can you believe it ?!

http://protostype.free.fr/index-sitepointversion2.php

Made minor height: changes
To facilitate your work I took screenshots in IE 7 8 9 and FF5
(netrenderer gives a different result than browserlab for IE8)

Radial gradients are only supported in ie10+ so they won’t show in IE9. The rest of the menu though is displaying fine in IE9.

I already gave you the fixes for the top menu and explained why IE8 and under needed different rules because of the way that the roration was handled. You need to shift the rotated items to the right because when rotated they don;t rotate on a central axis. The code I gave you before took all this into account so refer to before.

The alignment of the nav at the top is out because you haven’t catered for the margins on some elements. You also need to lose the side margin on the content for IE7.

e.g.


#header_main,section {margin-top:0;margin-bottom:0;}
#nav_main {
	position: relative;
	left: 215px;
	/*top:-25px; use margin-top instead*/
	margin-top: -25px; 
}
*+html #section_article_main{margin-left:0}


That lines it up in ie7 and 8 apart from the horizontal alignment of the rotated menu items and you should refer to the fixes I gave you before.

You are trying to squeeze too many things in for older browsers and making this much harder than it should be and using miles more code than necessary. You should let it degrade gracefully rather than trying to get all browsers the same as your code is now getting heavy and full of scripts. It would have been far simpler to use a few small images and I bet it would render quicker than the code you are using for similar effects.

Your fixed content columns and side columns are too tall and go through the bottom of my browses and are unreachable as I have mentioned a few times now.

• radial gradient: they aren’t supported in IE9- that’s why I used a filter, but it repeated the background so I commented the code. Any fix ?

• Are you sure about the selectors in #header_main,section {margin-top:0;margin-bottom:0;} ? I gave an Id to most elements, maybe you meant #header_main, #section_header_main

• Your fix repositioned vertically the menu in IE 7 8 but not 9 (although it moved a bit)

• Logo is mispositioned and clipped in IE9 only, dunno why.

• I’m puzzled that it doesn’t display better overall in IE 9, it was near perfect in a much earlier version. is border-radius supported for example ?

• I now see what you meant by unreachable, I changed again and gave a height to the sidebar and a bottom to the main content so that everything is visible within 600px

• Have you got any fix for preformating ? to avoid having to add <br> or <p> everywhere my idea was to preformat the content. I used white-space:pre-line and <pre> in case CSS was not used. But it seems impossible in IE to get both line breaks and line wraps, it’s either one or the other.

• I could have combined rules, other than that I don’t see how I could have done the same with less code. Degrading means coding in a way that it’s ok if it breaks in some browsers, like border-radius, right ? I’m against using images for style. I think it goes against degrading. I suppose you meant images for the rotated tabs, but that would have meant images for all tabs, and also text in images (which is bad).
The reason why I rotated them was because 1) they are tabs and thus need to be attached to the content 2) there were too many to fit above the content. The other possibility was to put them at the bottom of the content. Or maybe you have design tips.

None of those IE filters really work properly and I would avoid using any of them. They aren’t normal css and act on elements as a whole and change their behaviour dramatically. Adding gradient filters in ie9 will kill the round corners and cause loads of other problems. Adding filters (like the opacity filter) shouldn’t be used on positioned elements as it will kill the links.

Unless you understand all the bugs and associated work-around with filters then they should be avoided at all costs. They also dramatically slow the page down in IE and can make it barely work. It’s ok to use one filter for the odd occasion but you are blasting the page with multiple filters and multiple scripts and instead of html5 you have a page resembling the broken mark-up of the last century.

• Are you sure about the selectors in #header_main,section {margin-top:0;margin-bottom:0;} ? I gave an Id to most elements, maybe you meant #header_main, #section_header_main

The code I gave is correct and will fix IE.

• Your fix repositioned vertically the menu in IE 7 8 but not 9 (although it moved a bit)

IE9 didn’t need moving. You must be looking at in compatibility view or quirks mode or something.

• Logo is mispositioned and clipped in IE9 only, dunno why.

It’s fine in IE9 Windows 7.

• I’m puzzled that it doesn’t display better overall in IE 9, it was near perfect in a much earlier version. is border-radius supported for example ?

It’s fine in IE9. As I said above you have probably locally tripped the compatibility view and then none of the new features will work.

• I now see what you meant by unreachable, I changed again and gave a height to the sidebar and a bottom to the main content so that everything is visible within 600px

The solution you had before was much better in my opinion with no height and bottom:55px;

• Have you got any fix for preformating ? to avoid having to add <br> or <p> everywhere my idea was to preformat the content. I used white-space:pre-line and <pre> in case CSS was not used. But it seems impossible in IE to get both line breaks and line wraps, it’s either one or the other.

pre should only be used for pre-formatted content like code. Never use it in place of semantic html paragraph elements. Don’t use breaks either to make space either as they are not meant for spacing as such bit as line-breaks between things like addresses, poems or form elements. The rest of the time you should use the p element for paragraphs.

• I could have combined rules, other than that I don’t see how I could have done the same with less code. Degrading means coding in a way that it’s ok if it breaks in some browsers, like border-radius, right ? I’m against using images for style. I think it goes against degrading. I suppose you meant images for the rotated tabs, but that would have meant images for all tabs, and also text in images (which is bad).
The reason why I rotated them was because 1) they are tabs and thus need to be attached to the content 2) there were too many to fit above the content. The other possibility was to put them at the bottom of the content. Or maybe you have design tips.

Degrading doesn’t mean it should break in other browsers but rather they should get a simpler but still usable display. I owuld be ok with you rotating the tabs with filters (as with the code I have already given) but I would draw the line at all the other filters you are using for IE as they cause differences and problems in each that unless you are an expert you will be unlikely to solve by yourself. As I said before it’s actually quicker for me to recode the page than to fix the existing one because of all these problems. They must all be sorted at the time (and one at a time) as you implement them during design and not afterwards.

If you have too menu items to fit at the top of your structure then you need to re-think your page structure as users don’t like too many options. It becomes too baffling.

Then it’s browserlab and netranderer that are unreliable (as I thought) do you know (a free) one that is reliable ? next time I’ll set up a VM.

Ok, but does it cause issues for SEO ? that’s my only worry.
I guess browserlab and netranderer are wrong again because they don’t display pre-line properly when it’s supported.

Do you mean filters only ? not the JS IE fixes (if yes have you seen any problem they caused on my page ?) ?
So far rotate is the only filter I use.

You can never really trust these things 100% as there may also be differences between systems anyway xp/vista/windows 7. If you have windows then download IE9 natively so that you can test that for real. If you have a mac then install parallels (or similar) and run windows there (It’ll cost you though but it runs well as I have it on my mac).

If you have xp or vista you can use IEtester but its a little unstable but does give a pretty good guide. I have it on Windows 7 but it doesn’t render IE7 or png transparency unlike my old xp machine where it works well (apart from IE9 of course).

I also have a browsercam account which is better than the free ones but still has some problems when there are a lot of scripts on the page. Here’s some screenshots from browserecam of your page but IE9 hasn’t loaded because of a script issue (probably the ones I mentionbelow).

Ok, but does it cause issues for SEO ? that’s my only worry.

P elements will be good for SEO. I would guess that pre element content would not rate so highly as it has no meaning or connection with anything. Ie6 and 7 don’t support pre-line anyway but I am at a loss as to why you have used pre anyway unless this is some sort of specially pre-formated content coming from somewhere else that needs to remain as it was.

Do you mean filters only ? not the JS IE fixes (if yes have you seen any problem they caused on my page ?) ?
So far rotate is the only filter I use.

I thought I saw more than that but I may have been mistaken.

I do include IE js fixes to be avoided as I seldom see them working properly across all elements. Indeed it looks as though you are serving some fixes to IE9 also when there is no need.


[B]  <!--[if IE]>  [/B] 
            <style type="text/css">
		            body {behavior: url('http://protostype.free.fr/include/css/pseudoclasses-ie-fix.htc'); behavior: url('http://protostype.free.fr/include/css/PIE/PIE.htc');} 
            </style>   
         	<script type="text/javascript" src="http://protostype.free.fr/include/js/ie-fixes/IE9.js" title="http://code.google.com/p/ie7-js/"></script>   
        <![endif]-->


Does ie9 need the pseudoclasses-ie-fix.htc and the ie9.js?

Yes that’s it, I have a couple of long documents (7000 words) and it’s much simpler if I can just paste them and have them display properly, instead of adding <p> or <br> everywhere. Also makes updates much easier.
BTW: if I don’t use <br> how do I add a line break (not a blank line) inside <p> ?

Hmmm after verification, no, nor HTMLshiv.

Latest version http://protostype.free.fr/index-sitepointversion4.php
I tired to reposition both rotated menus from what I saw in browserlab.

Yeah, that’s why I grouped them. If I change the structure it means extra levels, which is not ideal either.

I think I’m done here. Thx again CSS master, couldn’t have done it without you.

P.S. I never learned CSS properly and because I don’t make websites everyday I don’t progress. What website or book do you recommend for grasping the magic behind the specifications ?

Well in your case its probably a matter of practice as you seem to be able to get things working eventually and it doesn’t look like you want to go back and start from the beginning. Most books teach the basics but it’s usually experience that shows how things work or don’t work in the real world. It is important to understand how property values are supposed to work so the Sitepoint online Reference is a good start.

If you do a search in the css forum for “CSS books” you will get loads of good recommendations as the question is often asked :slight_smile: