Jump to content

Css Adjustments With Ie8


K_Drive

Recommended Posts

I am helping develop a web application. One of my tasks is to reformat the page layouts. They were originally done by some other programmers who are not on the project anymore, and I get to make adjustments when there are changes made to the pages.The requirements for the app (which is NOT something I can change) is that it should be viewable for users with IE and FF. That used to mean: IE6, IE7 and FF. Now, with IE8, there is a problem, which I will explain.Before, with just IE6, IE7 and FF, I could make a lot of adjustments when necessary using "//" in the stylesheet file.IE would use it and FF would ignore it.Now, IE8 is out. The good news is that it is a lot closer to FF (i.e., w3 standards). I have been working with it for about a week now and FF and IE8 are very close and can use the same CSS styles. (Woohoo!!!)The bad news is that, now there conflicts between IE7 and IE8.For one thing, IE8 does not recognize the old "//". That is not so bad because it is very close to FF now. But, I now need to be able to hide something from IE8 or IE7. There are a few places where there is extra space between elements for one reason or another.Does anyone know of a little trick like "//" between IE7 and IE8 where one will see it and another will not? (I know IE8 is fairly new, but I'll bet that some people out there have discovered some tricks already!)Is there a website with more info on this?

Link to comment
Share on other sites

Putting // in the stylesheet is called a "hack" and I don't encourage them.You should try to code the site so that the same code adapts to all browsers, but in the case that you really need to do something specifically for Internet Explorer, then you can use conditional comments:

<!--[if lte IE 7]> This is only displayed in Internet Explorer 7 and under <![endif]--><![if !IE]> This is not displayed in any version of Internet Explorer <![endif]>

Link to comment
Share on other sites

Thank you for your reply, Ingolme.And, I agree. I don't like hacks either, but they are necessary when browsers don't interpret the CSS the same way. With the release if IE8, I think we are one step closer to browsers interpreting CSS the same way - or at least being acceptably close. It will be interesting to see what will happen with Google's browser. It is bound to get a lot of interest. I have not tested it at all.I was aware of the "If" statement you gave me. But, I did not know you could make it browser-specific. I also found this link with similar information:Position Is EverythingThanks, again for your help.

Link to comment
Share on other sites

If you are not already using a strict doctype and writing standards-compliant HTML, you should do so. I find that the kind of spacing issues you mention in the first post are often a consequence of the box model IE6-7 uses when it is not in standards-compliant mode.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...