Why use an attribute selector to match classes?
css, css-selectors
Solution
The `[]` syntax is an attribute selector.
a[class="btn"]
This will select any `<a>` tag with `class="btn"`. However, it will not select `<a>` which has `class="btn btn_red"`, for example (whereas `a.btn` would). It only exactly matches that attribute.
You may want to read The 30 CSS Selectors you Must Memorize. It's invaluable to any up-and-coming web developer.
Problem
I have found an example of responsive email templates where there are such CSS selectors such as the following: ``` a[class="btn"] ``` Why is this syntax used if it could be replaced with the simpler: ``` a.btn ``` Does it have any impact on mobile browsers or anything else? Are there email clients that require this usage?