Home >Web Front-end >JS Tutorial >How to set width in javascript
You can use the style object to set width in JavaScript, the syntax is "document.getElementById("Element Name").style.width="value"". The Style object represents an individual style declaration, accessible from the document or element to which the style is applied.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Style object represents a single style declaration. A Style object can be accessed from the document or element to which the style is applied.
Syntax for using Style object properties:
document.getElementById("id").style.property="值"
Style object properties:
Background
Borders and Margins
Layout
List
Miscellaneous
Position
Scroll bar
Form
Text
Specification
Background Property
Border and Margin properties
Layout property
List property
Positioning attribute
[Recommended learning: javascript advanced tutorial】
The above is the detailed content of How to set width in javascript. For more information, please follow other related articles on the PHP Chinese website!