Get the width and height of the element with display:none

Elements whose display is none cannot obtain width and height through offsetWidth and offsetHeight (not participating in CSS rendering),

Solution: You can set the width and height by using the inline style style on the element whose display is none, and get it through style.width and style.height,

Note: Styles cannot be written in css files. Otherwise you can't get it

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325223806&siteId=291194637