Internet Explorer compatibly stylesheet for WebKit? - css

I am working on a WebKit based browser, but things don't render properly on a IE - only site. Does anyone know of a stylesheet I can inject into these pages to make WebKit render like IE6? Kind of like an anti ie7-js.
I know the proper solution is to make the site standards compliant, but it's not under my control.
Thanks

A good start would be to implement IE's Quirks Mode if no !DOCTYPE is specified. Aside from that you can also support the X-UA-Compatible header to see if the site is designed for a particular version of IE.
Aside from that, there isn't much you can do. It's up to the website owners to decide "hey, we actually want users to be able to use our site" and actually make it standards-compliant.

There are three main things that make IE6 render so differently:
Bugs
Missing features
Quirks mode
You will never be able to (nor should you want to) try to replicate IE6's bugs in newer browsers. IE6's bugs are legendary. You probably have hacks and work-arounds to deal with them anyway, but be glad that you're moving on and away from them.
IE's missing features shouldn't be a problem for you, because your code just won't be using them. Nothing to worry about. Obviously, it would be a problem the other way if you'd written a site for a newer browser, but not for you.
The main point of those three you want to worry about is the third one: Quirks mode is the one that really mangles page rendering in older versions of IE compared with other browsers.
The correct solution to this is to use a valid <!DOCTYPE> at the top of your page. IE will go into standards mode, and will render the same as all other browsers. If your page is designed for quirks mode, then you may have to fix it, but this is probably the right thing to do anyway, and at least the rendering mode will then be consistent between all browsers.
A good doctype to use is !<DOCTYPE html>.
If you don't specify a doctype, then you will have a lot of compatibility problems going forward.
There is one quick way out: There's a CSS feature called box-sizing: border-box. If you set this CSS property in your site, then Webkit and other browsers will switch to rendering the boxes the same as IE's quirks mode.
This sounds like an ideal solution and a direct answer to your question, so what's the catch? As always, the catch is IE. Trying to use box-sizing CSS without fixing the <!DOCTYPE> issue will still leave you with areas of incompatibility, and if you do fix the <!DOCTYPE>, then IE6 won't render in quirks mode at all. It ought to be the solution, but in fact, box-sizing will still leave you with problems to fix.
So I'll say again that the correct solution is to add a <!DOCTYPE>, fix your site and move forward, not try to pull other browsers backward.

Related

Transform rotate not working in Quirks mode

I'm working on website that is quirks mode and can't use <!DOCTYPE html>.
In my project CSS3 translate image doesn't work in IE10 and 11 but it does work in IE9 for the reasons mentioned above.
Is there a solution to this problem except add <!DOCTYPE html>?
Just to be clear: The whole point of quirks mode is to emulate the way IE5 worked.
This includes disabling most of the HTML, CSS and JavaScript features that have been added to the browser since then.
If you are in quirks mode then you do not have those features. There is no work around or solution to this; that is how it is, and that's how quirks mode is intended to work.
If you have to use quirks mode then you also have to accept that your browser's capabilities will be from the 1990's.
Your only options are to work out how to upgrade your software so you can use it in a more modern browser environment, or else ditch the idea of using modern CSS and use whatever techniques where available back in the '90s. Probably a custom ActiveX control or a Flash animation. Pretty ugly, whichever option you go for.
I will also add the obvious point you really need to start thinking about how you're going to upgrade away from quirks mode. The default browser (Edge) that comes with Windows 10 doesn't support quirks mode at all. There will come a point in time when you simply can't avoid upgrading your desktop computers, and at that point, you may find that you simply won't be able to run your quirks mode site. It will be a lot easier if you start working toward dealing with that now than if you leave it and find it hits you in the face later on.

Doctype and Quirk modes and HTML 5

I am having quite a horrible time. We have a massive site that has no <DOCTYPE> and when I run it with IE10 it goes into quirks mode and after some CSS changes looks ok. As soon as I add echo "<!DOCTYPE HTML>";
The complete site looks terrible and the CSS is not looking as it suppose to. It turns the browser mode to IE10 and docmode to standard. Is there a way to keep HTML 5 functionality but use IE5 Quirks mode or just Quirks mode so the CSS will look correct?
No. The whole point of quirks mode is that it's a compatibility mode for IE5. This means that in addition to changing the layout mode, it also switches off most of the browser features that have been invented since IE5.
Therefore the blunt answer is no, you cannot mix Quirks mode and HTML5. It just can't happen.
However there is some good news for you: switching from quirks mode to standards mode is actually easier than it looks at first glance.
You don't have to go through your whole site changing all the CSS to suit the different box model, because standards mode does have a CSS feature that allows you to use the quirks mode box model while still remaining in standards mode.
Simply add the following to the top of your CSS code:
* {box-sizing:border-box;}
This will change all your elements to use the quirks mode box model, but your page will still be in standards mode.
This should sort out most (if not all) of the layout issues you've been having.
Hope that helps.
No, there isn't. The modern engine that includes the new features and the engine for emulating ancient, buggier browsers are separate entities and you can't mix and match parts of them.
As far as browsers other than IE are considered, you can add tags and attributes introduced in HTML5, without using any <!DOCTYPE>. The page will not conform to HTML5 then, but this is just a formality as such. Browsers do what they do, interpreting tags and attributes as they have been programmed to. There is no “HTML5 mode” in browsers that you would need to trigger with a <!DOCTYPE> or otherwise. Just try it. Throw in some HTML5 novelties like <input type=email> or <details>, and you will see that they work if the browser supports them in the first place, no matter whether there is a <!DOCTYPE> or not.
You would then have difficulties when using a markup validator, but that’s a different issue.
Quirks Mode is a real mess, with dozens of undocumented and poorly documented phenomena. If a page works in Quirks Mode and you then make browsers render it in Standards Mode, literally anything may happen, ranging from no effect to total disaster. So such a change is usually pointlessly risky. Keep using Quirks Mode for old pages developed to use it, and create new pages to work in Standards Mode (and possibly to be HTML5 conformant).
Quirks Mode affects styling and to some extent scripting. It marginally affects the interpretation of some old HTML attributes. But in most browsers, not the way new HTML5 features work.
However, IE is particularly quirky. On IE 10, the above seems to apply. On IE 11 Preview, deviations have been reported. And on IE 9, some of HTML5 novelties that it would otherwise support are not supported in Quirks Mode, such as the canvas element. So if you intend to add substantial use of new HTML5 features to an old page that now works in Quirks Mode, you may need to consider changing the page to Standards Mode first. Depending on the impact of Quirks features, this might be best done by rewriting the page, or it might be “only” a matter of redesigning the use of CSS to conform to CSS specifications.
[Answer corrected Oct 15, 2013.]

keeping sites looking the same in IE, Chrome and Firefox

Can anyone tell me the best way to ensure asp.net sites look the same when view in IE, Chrome or Firefox?
I've just finished one which in testing seems fine in IE but not the other 2.
I have not used CSS on this site as its not that big, I just formatted the masterpage as I wanted it.
Could that be the problem?
I usually code for Firefox first. That makes things match almost 100% in Chrome, Safari and IE9 usually. Then I go through and test in IE 8 and 7. Minor adjustments are typically made within the same CSS file. For example, IE7 usually needs to have dimensions of a container explicitly set, where most modern day browsers don't require it and render things properly.
In those rare cases that you do need to style something specifically for one or more versions of IE, use conditional comments. Here are some good links on conditional comments and how to target specific browsers and versions:
http://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx
http://www.quirksmode.org/css/condcom.html
Unfortunately you will need to use CSS to get this to look similar in all browsers. I say similar as it is unlikely you will ever get it looking exactly the same.
Basically you will need to use the conditional CSS tags http://www.javascriptkit.com/dhtmltutors/csshacks.shtml
I would recommend spliting out the style to the a CSS and getting that working in Chrome and Firefox. Then use the tutorial linked and add in IE hacks to make it look better.
There isn't an easy way of making a site look the same in all the browsers. As caveman_dick said, maybe it's even impossible. You have to use CSS and sometimes javascript...
But to help you, you can use some programs that simulate different browsers engines, so that you could see how your site behaves. Just google browser simulator. :)

Broswser Compatibility Problems. Looks good in Google Chrome but not in IE or Mozilla

I just built my first css website and it looks fabulous in Google Chrome, but after reviewing the site for browser compatibility, I see that in both IE and Mozilla, the site is a MESS. I have no idea what to do. Where do I start to fix the problems?
There can be no specific answer to your question, there could be any reason. The IE should be culprit for the most part; in your case though that doesn't work even in Mozila. Here are some links you may find useful:
Make your site cross browser compatible in 5 steps
The Importance of Cross Browser Compatibility: Tips and Resources
Complete Guide to Cross-Browser Compatibility Check
Cross Browser Compatibility Check Tools
You should be aware of various inconsistencies across browsers especially modern standard compliant ones with IE. There are also some possibilities to use:
Eric's Reset CSS
IE CSS Conditional comments
And finally, it is a good idea to validate your html at W3C just in case.
Since you give no code, there are 3 basic things you can do:
make sure you use a DOCTYPE that is HTML 4.01 or XHTML 1.0: http://www.w3.org/QA/2002/04/valid-dtd-list.html
validate your HTML: http://validator.w3.org/
validate your CSS: http://jigsaw.w3.org/css-validator/
having these will make sure you are using Standard Compliant Mode of rendering, and then if some particular item is not displayed right, you can post specific portion of code to ask about.
First, review your XHTML and the CSS and be sure you are not using anything that is coupled to a browser. See how you have used the styling. I can not give any specific answer as your question is too generic. If you use all standard ways, there will be little issues.

css not work without DOCTYPE !

Is there a way that without DOCTYPE tag all css are working ?
If you don't have a proper doctype, the page will be rendered in quirks mode. CSS will still work, but it will work differently.
What quirks mode mean exactly differs a lot from browser to browser. It has a very big impact on Internet Explorer, as it even uses a different box model.
Not really.
Browsers use the Doctype to determine if they should go into standards (aka strict) mode or quirks mode.
In quirks mode browsers are deliberately buggy so that they are compatible with bad CSS written for ancient, buggy browsers. The results are inconsistent.
It is essentially an intelligence test — is the author of the page smart enough to try to write to standards? If not, assume their CSS is just as bad.
The solution is to write good markup.
You should always try to use a doctype. You don't want your webpages to run in quirks mode, really.

Resources