White spaces in HTML attributes
Some of my class
attributes are generated by PHP, so sometimes there are extra whitespaces in HTML output, in example:
class=" hey joe "
As we can see there are:
- empty first char
- two empty 开发者_如何学JAVAchars between hey
and joe
- empty last char
May it cause some problems for browsers, web crawlers or other problems?
There is no problem with this. The class attribute accepts any number of classes separated by whitespaces. Trailing and leading whitespaces are not significant here.
Please see White Space handling in attribute values and Attribute-Value Normalization for authoritative details.
精彩评论