I added to every textarea, every textfield and every button a special class. I have many buttons and many textfields on my page so i decide to clean my code.
I delete all the special classes like (.textarea), (.textfield) and (.button) in the html code. Over 180 hits … so my code is shorter now.
I add the three new rules into the CSS -> input.button , input.text, textarea
But was this a good idea? Coz it dont work on every browser -.-
Is there a better method (rule) like -> input.button , input.text, textarea ? Or should i use my first solution?
In your CSS, use input followed by a type attribute check. For example, to apply a rule to text boxes and textareas, you’d use:
To apply a style to buttons, you’d use:
This works in all browsers that I’ve tested with (IE6+, Firefox, Chrome, & Safari).