width: ***; height: ***;
Browser |
|
---|
The width property specifies the width of an element, and the height property specifies the height of an element.
The width and height of the form fields can be specified by applying these properties to the INPUT, TEXTAREA, and SELECT elements.
textarea {
width: 200px;
height: 10em;
}
Property | Value | Explanation |
---|---|---|
width | length, %, or auto | the size of the width |
height | length, %, or auto | the size of the height |
The default is "auto".
Example
<html>
<head>
<title>TAG index</title>
<style type="text/css">
#example1 { width: 50%; }
#example2 { width: 150px; }
select { width: 250px; }
textarea {
width: 250px;
height: 10em;
}
</style>
</head>
<body>
<form method="POST" action="example.cgi">
<p><input type="text" name="item1" id="example1"></p>
<p><select name="item2">
<option value="select1">Select1</option>
<option value="select2">Select2</option>
<option value="select3">Select3</option>
</select></p>
<p><textarea name="item3" cols="50" rows="10"></textarea></p>
<p><input type="submit" value="Submit" id="example2"></p>
</form>
</body>
</html>
- Output
This form cannot submit because of a sample.