HTML DOM width Property
Complete Style Object Reference
Definition and Usage
The width property sets the width of an element.
Syntax
Object.style.width=auto|length|%
|
Possible Values
Value |
Description |
auto |
The browser calculates the actual width |
length |
Defines the width in px, cm, etc. |
% |
Defines the width in % of the containing block |
Example
The following example sets the width of a button:
<html>
<head>
<script type="text/javascript">
function setWidth()
{
document.getElementById("b1").style.width="300px";
}
</script>
</head>
<body>
<input type="button" id="b1" onclick="setWidth()"
value="Change width to 300 px" />
</body>
</html>
|
Try-It-Yourself Demos
width -
Set the width of an element
Complete Style Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|