As body:nth-of-type(1) and body:first-of-type are supported by FireFox 3.5x, the hack that I wrote about in this post cannot be used anymore. You may try the following one, which targets only Google Chrome and Safari:
@media screen and (-webkit-min-device-pixel-ratio:0)
{
div
{
color: red; /* The text will appear red only in Safari and Google Chrome */
}
}
Archive for the ‘Browsers’ Category
CSS Hack for Safari and Google Chrome: Redux
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, tagged css filters, css hack, google chrome css hack, safari css hack on July 30, 2009 | 3 Comments »
The Mystery of c:\fakepath Unveiled
Posted in Browsers, Forms, HTML5, Tips and Tricks, Web Development, tagged c:\fakepath, fakepath, file upload fakepath, HTML5, input type file fakepath on June 9, 2009 | 1 Comment »
Have you tried to manipulate the string that is returned by the value attribute of a file upload input (<input type=”file” />) under Internet Explorer 8? Did you get the strange c:\fakepath string? Relax - there is nothing wrong with your code, and although this is quite confusing, it has its justifiable reasons. Here is a screenshot of a [...]
CSS Hack for Internet Explorer 8
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, tagged css hack, IE css hack, IE8 css hack, Internet Explorer 8 CSS hack, Internet Explorer 8 hack, Internet Explorer CSS hack on June 4, 2009 | Leave a Comment »
Notwithstanding the improvements in the CSS support in Internet Explorer 8, there may be cases when a CSS hack for that particular browser is necessary. Here is one that works in IE8 Standards Compliance Mode:
.classnameOrElement
{
color /*\**/: blue\9
}
And another one that will be applied in all IE versions:
.classnameOrElement
{
color: blue\9
}
Better Image Scaling and Resampling in Internet Explorer
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, Web Development, tagged anti-aliasing, bicubic interpolation, image scaling, internet explorer, resampling on January 5, 2009 | 4 Comments »
Oddly enough, but the image scaling by using bicubic interpolation is turned off in Internet Explorer. All other browsers have this turned on by default, because this is the only normal and expected behavior. Due to this badly chosen default, sometimes the images in Internet Explorer are not displayed as smooth as in other browsers. To [...]
Setting Opacity and Other Filters in Internet Explorer 8
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, tagged css opacity, css transparency, DX filter, IE8 CSS filters, IE8 CSS opacity, IE8 DX filters, internet explorer 8 opacity, set internet explorer 8 opacity, set opacity to internet explorer 8 on November 28, 2008 | 2 Comments »
It was expected that Internet Explorer 8 will support the standard “opacity” property of CSS, but it seems that its developers have decided not drop the support for filters yet, which is not that bad, though, as it still lacks support for <canvas> scripting.
However, there is a great difference between the filter support in IE8 and its [...]
The 32 External CSS Files Limitation of Internet Explorer and More
Posted in Browsers, CSS, Tips and Tricks, Web Development, tagged 32 css files, 32 stylesheets, cannot load css files in IE, cannot load css files in internet explorer, internet explorer max css files, internet explorer max number of css files, max css files ie, max number of css files on November 25, 2008 | 1 Comment »
Recently, a client of mine complained that certain css files included in his webpage do not load in Internet Explorer. I took a look at his code and noticed that he had tried to register more than 40 external stylesheets in the <head>…</head> section of his webpage, which reminded me of a less known limitation in [...]
Using compatMode to Determine the Standards Compliance Mode of the Page on the Client
Posted in Browsers, JavaScript, Tips and Tricks, Web Development, doctype, tagged compatMode, compatMode FF, compatMode IE, compatMode Opera, determine if a page is in a standards-compliance or in, determine the doctype of the page, doctype, document type declaration, document type definition, dtd, get dtd, get the doctype of a webpage, quirks mode, standards-compliance mode, strict mode on October 21, 2008 | Leave a Comment »
Have you ever used the compatMode property JavaScript to determine if a web-page is in standards-compliant or in quirks mode directly on the client?
compatMode was first introduced in Internet Explorer 5.5, and later adopted by FireFox and Opera, and is rather convenient for third party component developers. One of its possible uses is if you develop [...]
CSS: Filtering and Distinguishing Google Chrome and Safari
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, tagged css filters, css hack, google chrome css hack, safari css hack on October 1, 2008 | 4 Comments »
As body:nth-of-type(1) and body:first-of-type are supported by FireFox 3.5x, the hack that I wrote about in this post cannot be used anymore. You may try the following one, which targets only Google Chrome and Safari.
Personally, I avoid using CSS hacks, and when writing client code I always assume that anything can be done the “legal” way.
However, [...]
Controlling the CSS Opacity Rate of Child Elements in Transparent Parents in Internet Explorer
Posted in Browsers, CSS, CSS Hacks, Tips and Tricks, tagged cancel transparency propagation, control the alpha opacity filter in internet explorer, control the propagation of alpha opacity filter in inte, css filters, CSS Hacks, css opacity, ie css hacks, inheritance of opacity in html elements, internet explorer hack, opacity, override opacity, override transparency, stop opacity propagation on September 11, 2008 | 4 Comments »
The alpha transparency filter applied on parent elements is inherited by their children, which is not always the desired behavior and can create unwanted design effects.
However, due to a browser bug in Internet Explorer, there is a cool hack that allows not only to reset the alpha transparency of the parent element in its children, but also to control [...]