他们被允许吗?它们是否适用于所有浏览器?
例子:
<div role = "region"
id = "some-id"
class = "a-class another-class">
最佳答案
是的,任何数量的空格都是允许的,并且适用于所有浏览器。
来自 Attributes section of the HTML5 living standard关于不带引号、单引号和双引号的属性值语法:
The attribute name, followed by zero or more ASCII whitespace, followed by a single U+003D EQUALS SIGN character, followed by zero or more ASCII whitespace, [...]
一个考虑因素 - 这会增加页面大小,因此如果需要考虑带宽和性能,请尝试限制您使用的空白数量。
https://stackoverflow.com/questions/7064095/