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.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

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