How to check if css value is supported by the browser?

前端 未结 6 1469
温柔的废话
温柔的废话 2020-12-14 17:06

Im not very skilled in javascript so please be bear with me. Safari 6 and below and older android mobile browsers and maybe more do not support the css value VH. My DIV#id o

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 17:42

    I see the code you have there.

    var styletotest = "PutStyleHere";
    
    if (styletotest in document.body.style)
    {
        alert("The " + styletotest + " property is supported");
    
    } else {
    
        alert("The " + styletotest + " property is NOT supported"); 
    
    }
    

    Simply place the css property you want to test in the quotes where it says

    PutStyleHere

    And when you load the file it will show a popup telling you if it works or not.

    However this seems unnecessary.

    Simply Googling:

    [property] css W3

    where [property] is the property you want to know browser support information.

    When I searched

    Opacity Css W3

    and then clicked on the W3 link... you can scroll down and you will see a section of the page with the info you want like this:

    Source

提交回复
热议问题