background-color: ***;
Browser |
|
---|
The background-color property specifies the background color of an element.
The background color of the form fields can be specified by applying this property to the INPUT, TEXTAREA, and SELECT elements.
input, select, textarea {
background-color: #85b9e9;
}
Property | Value | Explanation |
---|---|---|
background-color | color code or name | the color of the background |
In selectable list, the background color for the one list item can be specified by applying this property to the OPTION element.
Example
<html>
<head>
<title>TAG index</title>
<style type="text/css">
textarea {
width: 250px;
height: 7em;
}
input, select, textarea {
background-color: #bde9ba;
}
#example {
background-color: #ffffff;
}
</style>
</head>
<body>
<form method="POST" action="example.cgi">
<p><input type="text" name="item1"></p>
<p><select name="item2">
<option value="select1">Select1</option>
<option value="select2">Select2</option>
<option value="select3" id="example">Select3</option>
<option value="select4">Select4</option>
<option value="select5">Select5</option>
</select></p>
<p><textarea name="item3" cols="50" rows="7"></textarea></p>
<p><input type="submit" value="Submit"></p>
</form>
</body>
</html>
- Output
This form cannot submit because of a sample.