CSS Forms/Input Maniuplation
Posted
by
user983969
on Stack Overflow
See other posts from Stack Overflow
or by user983969
Published on 2012-07-11T15:04:13Z
Indexed on
2012/07/11
15:15 UTC
Read the original article
Hit count: 236
input:required{
background-color:#f00;
}
input:required label{
color: #FF3434;
}
I have the above CSS code currently for my form,
I want to be able to make the label red when the field is required. My input field is:
<label for="frmComTelephone">Telephone</label>
<input type="number" name="Telephone" id="frmComTelephone"/>
But that CSS isn't working how do I solve this?
2ND problem is I have the following CSS:
input:focus
{
background-color:yellow;
}
input[type="text"], input[type="date"],input[type="time"],input[type="number"],textarea,select
{
border-radius:5px;
border-width: 1px;
border-style: solid;
border-color: #C6C6C6;
height:41px;
background-color: #FF3434;
width: 100%;
}
But when the item is focused it doesn't change to yellow, if i remove "background-color: #FF3434;" it turns yellow on focus?
Is what I am doing not able to be done? Or am I going about this wrong?
Thanks
© Stack Overflow or respective owner