Mr Sooul
Mr Sooul

Reputation: 699

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 chars between hey and joe - empty last char

May it cause some problems for browsers, web crawlers or other problems?

Upvotes: 1

Views: 296

Answers (1)

Arnaud Le Blanc
Arnaud Le Blanc

Reputation: 99921

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.

Upvotes: 9

Related Questions