September 2, 2010

css – use attribute selector or set class name?

Question by StoneHeart

Should we use

css: input[type='submit']{...}

or set class name for input tag?

html: <input type="submit" class="submit">
css: .submit{...}

Answer by Sarfraz

You should use the class name instead of attribute selector if you want to support IE6.

This article is interesting:

Answer by Starx

Yes, As Sarfraz said if you go for browser compatibility you should go for class name, but attribute selector provides a vast range of control over any elements.

...

Please fill the form - I will response as fast as I can!