Is there a way to apply multiple CSS styles in a batch to avoid multiple reflows?

前端 未结 5 946
别跟我提以往
别跟我提以往 2020-12-30 05:56

I know that altering element\'s style via JavaScript directly will cause a reflow. However, I was wondering if it is possible to alter multiple style values in a batch with

5条回答
  •  误落风尘
    2020-12-30 06:43

    use:

    document.getElementById('elemnt_ID').setAttribute('style','color:white; margin:5px;');
    

提交回复
热议问题