Forum Moderators: not2easy
label, input {
display: block;
width: 300px;
float: left;
margin-bottom: 1em;
}
textarea {
display: block;
width: 300px;
height: 140px;
float: left;
margin-bottom: 1em;
}
label {
text-align: right;
width: 150px;
padding-right: 20px;
}
input.submit {
width: 5em;
float: none;
margin-left: 171px;
}
br {
clear: left;
}
form input, form submit, form textarea {
background: #EEEEDF;
}
input:hover, submit:hover, textarea:hover {
background: #FEFEF8;
}
input:focus, submit:focus, textarea:focus {
background: #FEFEF8;
}
#content {
margin: 75px 0 9em 80px;
font-size: 1.2em;
}
<form>
<label for="first name">First Name:</label>
<input id="first name" name="first name"><br>
<label for="last name">Last Name:</label>
<input id="last name" name="last name"><br>
<label for="email">Email:</label>
<input id="email" name="email"><br>
<label for="comments">Comments:</label>
<textarea id="comments" name="comments"></textarea><br>
<input type="button" value="Submit" class="submit">
</form>
onfocus="this.className = 'foo';" onblur="this.className = 'bar';" for when JS support is available without sufficient CSS support (such as IE6 and older) [edited by: DrDoc at 3:42 am (utc) on Mar. 25, 2008]
IE6: Try the IE7 (or IE8) scripts to make it a bit more compliant:
[code.google.com...]
* html .iehover { /* IE6 hover */
m: expression(this.onmouseover = new Function("this.className = 'iehover-hover';"));
}
* html .iehover:hover, * html .iehover-hover{ /* IE6 hover */
background: #FEFEF8;
m: expression(this.onmouseout = new Function("this.className = 'iehover';"));
}
* html .iesubmithover { /* IE6 hover */
width: 5em;
float: none;
margin-left: 171px;
m: expression(this.onmouseover = new Function("this.className = 'iesubmithover-hover';"));
}
* html .iesubmithover:hover, * html .iesubmithover-hover { /* IE6 hover */
width: 5em;
float: none;
margin-left: 171px;
background: #FEFEF8;
m: expression(this.onmouseout = new Function("this.className = 'iesubmithover';"));
}