IE8: Disable cleartype?
Asked Answered
V

8

25

For IE7, it's possible to add

filter: none;

to the body css to disable cleartype on fonts through CSS. I don't like the fuzzy look it gives, and it isn't really consistent across browsers. IE; Firefox and IE6 show it differently.

IE8 however, seems to ignore the css option, even when forcing the browser into IE7 compatibility mode using:

<meta http-equiv="X-UA-Compatible" content="IE=7" />


TL;DR: How do I disable clear-type fonts in IE8 through CSS?

Vetchling answered 23/6, 2009 at 9:29 Comment(10)
To the downvoters: My question was not if it was a good idea to disable cleartype - you can leave that up to my own consideration. The question was HOW to do it.Vetchling
Do you like it when your browser is hijacked? When the window is resized? When you get spammed with popups? When the address bar is disabled? This is a classic case of thinking you know better when you clearly have no right or need to be messing with it at all. Consider the reverse - what if a website forced cleartype to be on?Raper
I'm not downvoting as I think it is an interesting question. However unless you are creating the web site exclusively for yourself, why would you want to override the user's ClearType settings?Heroworship
@Richard: Not only is it my personal preference (cross-browser consistency and I just don't like clear-type), but the customer that the webpage is being developed for specifically mentioned it. Meaning; I would end up doing this regardless of my own preference.Vetchling
If it matters at all, the webpage will be used inhouse (intranet) by the customer.Vetchling
One of the most important lessons I've learnt is, "the customer is not always right". Half the time, they don't even know what they want. If a customer asked you to implement an exploit to install spyware on visitor's PCs, would you do it? Just explain that it's not reliably possible or even desirable.Raper
If I want clear type turned off, I'll turn it off. As a user, this is not a decision I want web sites making on my behalf.Doerrer
@Joel, then lucky for you this isn't a question about what you want as a user.Vetchling
I was wondering why jQuery.fadeIn looks terrible on large fonts in IE8, and this question has helped me figure out that its probably related to ClearType. So maybe I'll just try and disable it during the fade? Anyway, my point is that this question was useful to me.Synder
Contra Joel, if ClearType makes the text on a page uglier or harder to read, I'd be thrilled if my browser would automatically render it without ClearType. Failing that, if the Web page itself wants to disable ClearType, great. CSS provides thousands of knobs to let you tweak the way text and other web content appears. Just because there are system-wide preferences for ClearType doesn't mean it shouldn't be subject to CSS; after all there are system-wide preferences for fonts and colors too.Jaine
S
18

From what I recall, Internet Explorer 7+ disables ClearType when a filter is set on an element

#target {
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=99)";
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=99);
}

Also, do consider that many users may find disabling ClearType to be annoying. Use sparingly!

Sinuosity answered 23/6, 2009 at 9:39 Comment(6)
Perfect. Does it also work with -ms-filter:none; filter:none; as well? because that's probably more correct.Sinuosity
Ah, too bad. As is, the markup seems a little ugly. Also, added warning to hold off the downvoters :)Sinuosity
And as predicted this ceases working in IE 9. Hooray. One web developer less who tries forcing his ways onto his readers.Globule
@joey there a legitimate reasons to disable cleartype, like when ie 7 and 8 screw up embedded fonts. thankfully ie 9 does it right.Cattycornered
@joey or... drumroll Pixel fonts! I like my pixel fonts crispy, thank you, and I want my users to see it as such!Cannibalize
Maurycy: If you design pixel fonts as outline fonts without proper hinting you deserve blurry display, anyway.Globule
G
16

You can't. ClearType is a user setting on the browser. Any CSS which would disable it for certain elements is most likely a bug, not a feature (I've noticed it gets disabled for some dynamically generated or animated elements) and shouldn't be relied upon.

Whatever your preference in this regard is is probably not the user's one who sees your site. So why bother? Whoever doesn't like ClearType probably has it disabled already.

Note: The reason why it works with filters is that filters are not rendered by the browser but something else (DirectX probably, considering the "DX" in there. I'd still consider that a side-effect, and not a feature).

Note 2: Fixed as of IE 9, as expected. This really is a battle you can only lose, as many have told you before except you wouldn't listen.

Globule answered 23/6, 2009 at 9:34 Comment(3)
Yeah, you leave my ClearType alone!Rubato
I understand your concerns but, although constructive, it's not an answer to the question. (and also wrong in regards to not being able to do it in IE8)Vetchling
It's the answer best showing an understandig of what's going on. Even if you could find another IE8 hack, chances are that hack will also be fixed in IE9. You're fighting a battle you can't win. If you want pixel-perfect rendering, serve a PNG and forget about Opera Mobile.Sullage
D
3

There is no CSS solution to disable cleartype. The reason that you could do it in IE7 was a biproduct of how the browser rendered text in elements that used filters. Appearently IE8 handles this better so that you can't use that hack any more (at least not without actually applying some filter).

The use of cleartype is a user choice, and not something that you should impose on visitors. Personally I really like cleartype, and if I visisted a site where it was disabled I would think that the site looked really crappy.

The fact that text is rendered differently in different browsers and different operating systems is something that you have to live with. If you want it to look exactly the same for everyone, you have to make it an image.

Dally answered 23/6, 2009 at 9:45 Comment(3)
Why the downvote? If you don't say what it is that you don't like, it's pretty useless...Dally
Is it true that IE8 fixes the ClearType "pop" during effects like fade? That would be great. I never understood why IE couldn't get it right when the other browsers seemed to do fine on Windows.Ezequieleziechiele
Completely agreed. Why worry about IE7/8/9, when another browser or operating system will do it completely differently anyway? Text on OS X will look nothing like text on Windows will look nothing like text on Linux. Trying to make text display pixel perfect is an exercise in futility.Cheslie
B
3

Juliano, body{ filter:none } is a better, cleaner solution. Using opacity causes problems in some situations.

To answer all the ClearType enthusiasts--I like ClearType too. I think it's a great advancement for LCD monitors. Problem is that when IE tries to use ClearType on some specific elements, it looks worse than if you had ClearType disabled. These include elements that are faded into view (using javascript) as well as imported @font-face fonts. If you like ClearType, then you're going to hate what IE does when it tries to use ClearType in these situations...your text looks chunky, fat and ugly.

In these cases, ClearType should be removed if possible to achieve the smooth fonts you guys want.

Bucharest answered 30/3, 2010 at 3:34 Comment(0)
N
1

Cleartype sometimes looks stupid in JavaScript/AJAX-based solutions but this topic possible answers to that question why some jQuery based animations look be broken in IE.. so answer is that when JavaScript makes fade effect with opacity (opactiy to 0 from 100 in 1 second duration) then cleartype fonts are removed from element that come to fade out and animation looks really bad.

Nga answered 12/7, 2009 at 18:53 Comment(0)
M
1

There are a lot of people not listening here I feel. @Daniel Sloof said all along he was asking how, not whether or not it's a good idea. IE is a bad idea full stop but the fact is many people still use older versions of it and of those people I would hazard a guess that 90% don't know even know what Clear Type even is - I sure as hell didn't until I started debugging sites. They certainly aren't aware just how rubbish their browser is. If you want to design smooth functioning pages that look as slick in IE as they do in webkit you have to embrace the odd hack from time to time, sure its not pretty but that's life. Most people will be more influenced by a pretty site than pretty code.

@capnhairdo is bob on when he says about @font-face too - have any of you actually tested these fonts with Clear Type enabled in IE7 and 8? If you had you'd realise many are rendered horribly - like what you'd get normally with CT disabled - kind of defeats the object in selecting a nice font in the first place and for many the likes of Cufon and Sifr are not viable solutions. To some of us its ok for things to look mediocre. For me its not, my website sells my image.

When you consider even Apple are forcing IE7 emulation for IE8 on their site it should emphasise that most people really aren't impacted upon by minor deviations from 'recommended practice', instead they notice far more a site that delivers a crap aesthetic and is barely readable. That's not doing anyone any favours and is a problem which can occur with CT on! I strive for as much consistency as possible and couldn't give a stuff what choices an IE user should and shouldn't have in that situation. Microsoft stuffed up by making browsers that tried to deviate from standards, that they themselves have released hacks and fixes for so we have to work with it. If that means taking advantage of a bug to fix an issue then providing it's not impacting greatly on performance, bandwidth, or usability just do it! Life's too short to mess about around quoting standard compliancy, I respect neat code and strict methodology to an ideal but come on, you guys have as good as said it yourselves perfection doesn't exist. Good design and construction comes from a balanced perspective. Here endeth the rant :-P

Maribelmaribelle answered 26/1, 2013 at 1:46 Comment(0)
G
0

for some reason positioned elements (anything inside { position: relative } ) -- isn't animated w/ an opacity less than 1.

Gyroplane answered 27/5, 2010 at 21:28 Comment(0)
C
0

You can have both an MS CSS filter on an element and still enable ClearType on the font within. Just add a child element and set its css "position" to "relative" and ClearType does not get disabled. Copy the following and try it.

<style>
#parent{
     background-color:white;
     filter:progid:DXImageTransform.Microsoft.Shadow(color=#000000,direction=180,strength=2);
     position:relative;
     border:solid 1px black;
     padding:10px;
     width:500px;
}
#child{
     position:relative; /*THIS SOLVED THE CLEARTYPE DISABLING PROBLEM IN BOTH IE7 & IE8*/ :)
}
</style>

<div id="parent">
     <div id="child">This text should always be smooth</div>
</div>
Conquest answered 22/9, 2010 at 18:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.