问题描述
我找到了的响应式电子邮件模板,其中有诸如以下CSS声明之类的CSS声明:
I have found an example of responsive email templates where there are such CSS declarations such as the following:
a[class="btn"]
为什么使用这种语法,如果它完全相同:
Why is this syntax used if it's totally the same as:
a.btn
是否对移动浏览器或其他任何内容有影响?
Does it have any impact on mobile browsers or anything else?
推荐答案
[]
语法是。
a[class="btn"]
这将选择< a>
标记与 class =btn
。但是,不会选择 class =btn btn_red
的< a>
>,例如(而会)。
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.
这篇关于类的方括号选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!