How to set browser specific css in JavaScript?

前端 未结 5 1215
再見小時候
再見小時候 2021-01-13 17:48

How to set style -webkit-box-shadow: 0px 0px 11px #000 to an element via JavaScript?

5条回答
  •  离开以前
    2021-01-13 18:20

    You can set it using the style object:

    element.style['-webkit-box-shadow'] = '0px 0px 11px #000';
    

    Demo: jsfiddle.net/S2eLb/

    Edit:

    To be clear, this method does not require the jQuery library.

提交回复
热议问题