Should we use
css: input[type='submit']{...}
or set class name for input tag?
html: <input type="submit" class="submit">
css: .submit{...}
Should we use
css: input[type='submit']{...}
or set class name for input tag?
html: <input type="submit" class="submit">
css: .submit{...}
You should use the class name instead of attribute selector if you want to support IE6.
This article is interesting:
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.
IMO, it all depends on exactly what style you're applying - in addition to the general browser support factors that others have already mentioned, of course. For example, if what you're applying is an absolutely core part of your design (e.g. layout), then it's probably safest to stick with a class name.
However, if what you're applying is a 'decorative flourish' and, in particular, if it's CSS that isn't even supported in older versions of IE anyway (think border-radius, for a start) then it's much better to keep your markup clean and make use of the attribute selector.
Under similar circumstances, you may deem it worthwhile to progressively enhance via javascript - i.e. leave the markup nice and clean but add a class or inline style to the element using JS.