Duncan Hill wrote:
On Thu, 16 Sep 2010 01:24:40 +0100, Keith Purtell
<keithpurt...@keithpurtell.com> wrote:
In my search for information about accommodating different browsers,
I've come across four recommended approaches:
1-Write a JavaScript to load separate style sheets.
2-Use JavaScript to write "local" css in the page header.
3-Use conditional comments to insert JavaScript or css into the header.
4-Write a single css style sheet that is cross-browser.
[snip]
- Keith Purtell
#4 Not as difficult as you seem to suspect, David has provided a couple
of the important 'hacks' to target IE. They will be ignored by other
browsers but may prevent validation of your stylesheet which isn't the
end of the world in many cases.
The hacks to target and filter the different versions of IE are all
valid but should not select anything.
* html /* IE6 */
*+html /* IE7 */
*:first-child+html /* IE7 */
The basic premise is that IE6 or below see this,
<!-- --> <html>
and IE7 see this.
<!DOCTYPE> + <html>
IE8 was the first browser that became really hard to target with any hack.
Much more important, in my opinion, is to write clean CSS that is
focused carefully on what you are aiming for in terms of style, i.e.
don't throw in rules for the kitchen sink if you don't have a kitchen
sink on the site!
Test and design in a fully compliant browser, THEN pick up the pieces
for Internet Explorer.
IE 8 will be reasonably steady with CSS 2 / 2.1
IE8 was the best in CSS2 and CSS2.1 when it was released. Since that
time, Gecko has caught up. WebKit has it bugs and so does Opera. Now
with IE9 coming, it may be a battle between IE9 and Gecko that is the
most standard complaint browser with CSS2, CSS2.1 and CSS3.
IE 7 trips up here and there but is not too hard to push into shape.
Somewhat true but it is IE7 that still causes one to not go to hard
with either CSS or even the HTML. Some CSS bugs can not be fixed
without an altering or reordering of the HTML.
IE 6 is far from dead (as most would wish), some things are fairly easy
to correct, or you could opt for just providing it with a basic style
via conditional comments.
Give IE6 style that it can cope with, no conditional comments and no
mercy.
CSS 3 is only possible in any of them with the help of JavaScript.
IE8 support some CSS3.
Best wishes
Duncan
There is a reason that the following code (exactly as it appears) will
render the same in most browsers except for Opera and WebKit.
<!DOCTYPE>
<div>Hello
<style type="text/css">
div {
background: silver;
color: red;
font-size: 300%;
}
Since most browsers when served HTML4.1 or HTML5 with a valid doctype
will happily repair tag soup.
--
Alan http://css-class.com/
Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/