Set element width or height in Standards Mode

后端 未结 2 1564
太阳男子
太阳男子 2020-12-13 03:05

Is it possible to set width or height of HTML element (ex.

) in JavaScript in Standards Mode?

Note the following code:



        
2条回答
  •  佛祖请我去吃肉
    2020-12-13 03:38

    The style property lets you specify values for CSS properties.

    The CSS width property takes a length as its value.

    Lengths require units. In quirks mode, browsers tend to assume pixels if provided with an integer instead of a length. Specify units.

    e1.style.width = "400px";
    

提交回复
热议问题