Important: When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add padding, borders and margins.
Try declaring the unit of width:
e1.style.width = "400px"; // width in PIXELS
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";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With