Which version?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Plankmeister

    Which version?

    Hi.

    I'm redesigning my site using CSS and have just decided to start again from
    scratch as I was using too much javascript to do positioning and stuff. My
    question is: What version of CSS is it safe to use? Since I last used CSS,
    version 2, 2.1 and 3 have popped up. Is it still better to use CSS1, or is
    it safe to use CSS2? Or 2.1? I guess 3 is not a good idea right now.

    Any comments appreciated...

    P.


  • Keith Bowes

    #2
    Re: Which version?

    The Plankmeister wrote:[color=blue]
    > I'm redesigning my site using CSS and have just decided to start again from
    > scratch as I was using too much javascript to do positioning and stuff. My
    > question is: What version of CSS is it safe to use? Since I last used CSS,
    > version 2, 2.1 and 3 have popped up. Is it still better to use CSS1, or is
    > it safe to use CSS2? Or 2.1? I guess 3 is not a good idea right now.
    >[/color]

    For optimum browser compatibility, use CSS1 with some widely-supported
    CSS2 (positioning, cursors, system colors and fonts, etc). But ideally,
    there is no reason you can't use advanced stuff for browsers that
    support those things, or may some day. CSS 2.1 probably isn't good
    right now, because it corrects certain errors and browsers tend to do
    them the CSS2 way. CSS3 is a series of working drafts, though things
    like selectors and colors are stable.


    Comment

    • Brian

      #3
      Re: Which version?

      The Plankmeister wrote:[color=blue]
      >
      > What version of CSS is it safe to use?[/color]

      Depends on the browser, of course. MSIE 5.x can't handle much of
      CSS1. Mozilla and Opera can do most of CSS2, and ignore that which
      they can't do, which is the correct behavior. N4 chokes on so much of
      CSS that it isn't worth the effort. Hide all css from that browser
      for its own good. NS4 users will get a plain but usable site,
      assuming you have written robust and valid html, which you should do
      in any case.
      [color=blue]
      > Is it still better to use CSS1, or is it safe to use CSS2? Or 2.1?[/color]

      Code for CSS2, and hide css from N4 and MSIE/Win5.x/6 as needed.
      < http://w3development.de/css/hide_css_from_browsers/ >
      [color=blue]
      > I guess 3 is not a good idea right now.[/color]

      Only a few ideas are supported, and only by Mozilla and, possibly,
      Opera. You can add these in, and if a browser can't handle it, it
      should ignore it, which is safe behavior. Note the MSIE and N4 caveat
      detailed above.

      --
      Brian
      follow the directions in my address to email me

      Comment

      • Jim Dabell

        #4
        Re: Which version?

        The Plankmeister wrote:

        [snip][color=blue]
        > What version of CSS is it safe to use? Since I last used CSS, version 2,
        > 2.1 and 3 have popped up. Is it still better to use CSS1, or is it safe to
        > use CSS2? Or 2.1? I guess 3 is not a good idea right now.[/color]

        Like any web technology, none of them are truly safe to use unless you test
        in user-agents that are important to you. However, there are some parts of
        CSS that are more dangerous than others.

        CSS 1:

        Most graphical browsers in common use today support almost all of this
        specification. You can expect it to be implemented pretty consistently
        from Internet Explorer 5.0+ on both the Windows and Mac platforms, any
        Mozilla derivatives (including Netscape 6.0+), and KHTML derivatives
        (Konqueror, Safari, the next version of Omniweb).

        However, there are still plenty of user-agents that cannot or will not
        support CSS at all, or may only implement parts of it. For instance, Lynx,
        or search engines. You need to ensure your HTML is up to scratch.

        CSS 2:

        A five-year-old specification, large parts of it still aren't implemented by
        any version of Internet Explorer. The browsers I mention above can all
        understand most of CSS 2 though, so for most websites, you can be pretty
        confident when sticking to the subset of CSS 2 that Internet Explorer
        understands.

        Internet Explorer does not understand the table parts of CSS 2, and some
        types of selector (attribute selectors and direct descendant selectors, off
        the top of my head, there may be more). It also gets the box model wrong,
        but google for "box model hack" to find out how to handle this. Internet
        Explorer 6.0 includes a "Standards" mode that gets a bit more of CSS 2
        right. Internet Explorer also has some pretty nasty bugs that flare up
        from time to time, but they are mostly understodd and documented enough to
        be easily googlable, and usually have simple workarounds.

        CSS 2.1:

        Faced with loads of crap implementations , the CSS WG decided to put out a
        specification that more accurately described what is understood by current
        UAs. Basically, they took CSS 2, ripped out the obscure bits that hardly
        any browser got right (e.g. counters), and republished it as CSS 2.1. You
        are probably safer authoring to CSS 2.1 than you are authoring to CSS 2.

        CSS 3:

        Mostly in draft status. You may find the odd browser that supports some CSS
        3 properties (e.g. Mozilla derivatives understand -moz-border-radius
        properties, which closely follow the border-radius CSS 3 property). I
        believe recent versions of some browsers understand some CSS 3 selectors.

        Miscellaneous:

        Lots of browsers limit the ability to style form control elements.

        It's typical to find that an element rendered by a plugin has an infinite
        z-index.

        You can do stupid things with CSS as well as smart things. For instance,
        setting the font size in absolute units isn't very smart. You'll pick
        things like this up if you read this group for a while.

        There is no harm in supplying CSS that some browsers don't implement. Just
        because you can't get the effect you want in some browsers, it doesn't mean
        that the users of other browsers can't benefit from it.

        Internet Explorer on Windows and Internet Explorer on the Mac use entirely
        different rendering engines. Don't let the name fool you, treat them as
        different browsers.

        Lots of user-agents that read web pages out to the user aurally actually pay
        attention to CSS that is specifically intended for the screen. So don't be
        surprised if your content marked as @media "screen" {foo{display: none;}}
        doesn't get read out in JAWS or IBM Home Page Reader.

        It's usually best to stick to "standards mode" in browsers that do doctype
        switching (lots of browsers have different rendering modes, google for
        info).

        A common technique is to exploit the parsing bugs of some browsers to supply
        different CSS to different browsers.

        <URL:http://w3development.d e/css/hide_css_from_b rowsers/>


        Basically, until you have gotten used to CSS, check in browsers that are
        important to you as much as possible. After a while, you know what to
        avoid and are confident enough to write to a reference browser and fix up
        the messes other browsers may make of it at the end. Oh, and talking of
        reference browsers, use something with good CSS support, otherwise you are
        just creating work for yourself. I recommend the latest stable version of
        Mozilla.


        --
        Jim Dabell

        Comment

        • Sue Sims

          #5
          Re: Which version?

          On Mon, 15 Sep 2003 17:55:58 +0100, Jim Dabell <jim-usenet@jimdabel l.com>
          wrote:
          [color=blue]
          > Basically, they took CSS 2, ripped out the obscure bits that hardly
          > any browser got right (e.g. counters), and republished it as CSS 2.1.[/color]

          Alert: counters are still in CSS2.1, as mentioned here
          <URL:http://www.w3.org/TR/2003/WD-CSS21-20030915/generate.html#c ounters>

          and still supported by Opera.

          Sue

          Comment

          Working...