为什么?因为您将来可能会为此元素添加更多类.但为什么这很重要且与性能有关?看看这个:
It’s a common belIEf that ID selectors are the fastest,but this comes
with a big caveat: IDs are fastest CSS selector only if they’re the
key selector. What’s that? Well,while you probably read selectors
from left to right,browsers read them from right to left.
有关更多详细信息,请查看此site.
总结以上是内存溢出为你收集整理的我是否应该使用一个类甚至单个html元素?全部内容,希望文章能够帮你解决我是否应该使用一个类甚至单个html元素?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)