src和data-src属性之间有什么区别? [英] What are all the differences between src and data-src attributes?
问题描述
使用 data-src
或 src
属性的差异和后果(无论是好还是坏) img
标记?我可以使用两者达到相同的结果吗?如果是这样,什么时候应该使用它们中的每一个? 属性 src
和 data-src
没有任何共同之处,除了它们都被HTML5 CR所允许并且它们都包含字母 src
。其他的都不一样。
What are differences and consequences (both good and bad) of using either The attributes The The 这篇关于src和data-src属性之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
数据的无限集合之一 - *
属性,它们没有定义的含义,但可用于在元素中包含不可见的数据,以用于脚本(或样式)。data-src
or src
attribute of img
tag? Can I achieve the same results using both? If so, when should be used each of them?src
and data-src
have nothing in common, except that they are both allowed by HTML5 CR and they both contain the letters src
. Everything else is different.src
attribute is defined in HTML specs, and it has a functional meaning.data-src
attribute is just one of the infinite set of data-*
attributes, which have no defined meaning but can be used to include invisible data in an element, for use in scripting (or styling).