Say I want to apply a style to all search inputs, and I don’t want to have to assign a class to each one. I do this:
input[type=search] {
}
But, I also have a primary search field which is to be styled differently to search fields that appear inside forms etc. Applying this styling with a class name has no effect (unless I use !important
, which I don’t want to do), but using id works just fine.
Has anyone else run in to this behavior? Since there is only ever a single primary search field on any page I would be inclined to just stick with an id selector, but if there is a way of using a class name I’d be interested to hear it.