SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Test for support of specific CSS property value

    Is it possible to find out whether a browser supports a certain value for a particular CSS property? Something like
    Code:
    if (element.style.display.fixed) {do stuff}
    for example to check if the browser supports position:fixed. I know the above doesn't exist, but is there anything of the sort that can be done?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Raffles,

    I thought I had an idea for doing this - but it doesn't work like I expected.

    FF2 gives true then true.
    Op9.10 gives true then true.
    IE7 gives false then true.
    IE6 gives false then true.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Template</title>
    <script type='text/javascript'>
    var result = false;
    window.onload = function()
    {
      var ele = document.getElementById('d1');
    
      try {
        ele.style.position = 'stuff';
        result = true;
      }
      catch (e) {
        result = false;
      }
      alert("ele.style.position = 'stuff'\n\nresult = " + result);
    
      try {
        ele.style.position = 'fixed';
        result = true;
      }
      catch (e) {
        result = false;
      }
      alert("ele.style.position = 'fixed'\n\nresult = " + result);
    }
    </script>
    </head>
    <body>
    
    <div id='d1'>d1</div>
    
    </body>
    </html>

  3. #3
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That's odd about IE6. 'stuff' and 'fixed' should be equally foreign to it. It seems like it knows that 'position' can be 'fixed' but it doesn't do anything with it, as we know.

    Thanks for trying, Mike.


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
  •