SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Determining Supported CSS Attributes

    Is there anyway using Javascript, one can determine whether or not the browser viewing the page supports a particular CSS property or value? For example, I know IE6 doesn't support the value of "fixed" for the "position" property, so is there anyway I can determine this with Javascript, without resorting to browser sniffing?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Nope, it's not possible.

    The standard techniques for dealing with this are to use progressive enhancement.

    Start with the HTML content.
    Use CSS for presentation.
    Enhance behaviour using JavaScript.

    If you want to provide or limit specific css code to certain IE versions, you can use conditional comments to achieve a certain level of granularity.

    http://msdn.microsoft.com/en-us/libr...12(VS.85).aspx
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would imagine you could fabricate a test for most things by making the change and using javascript to measure the effect on it's position/dimensions etc... Doesn't sound like fun.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    If the css property is initially set from CSS, it can be next to impossible to discover it from JavaScript.

    Quirksmode has a good page on the troubles and tribulations there-in.
    http://www.quirksmode.org/dom/getstyles.html
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought this would be the case. Oh well.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •