I have a default style for my input boxes. I would like to add an additional style to the box when I specify a class of “req”. It’s not working. Here’s my code.
CSS:
input{background-color: #000; color: #FFF; border: 1px solid #515151; width: 230px;}
input req {background-color: Purple;}
HTML:
<input id="FirstName" type="text" class="req" />
The textbox reflects the input class, but not the sub class. Any ideas?
In your CSS stylesheet, change:
to:
(
input.reqdenotes allinputelements that belong to classreq, whileinput reqdenotes allreqelements that are inside aninputelement. The dot prefixed class name is merely shorthand for the[class~=req]attribute selector.)