Spaces between html attributes and values?

Ian Storm Taylor picture Ian Storm Taylor · Aug 15, 2011 · Viewed 8.5k times · Source

Are they allowed? and do they work with all browsers?

Example:

<div role = "region"
     id = "some-id"
     class = "a-class another-class">

Answer

Oded picture Oded · Aug 15, 2011

Yes, any amount of whitespace is allowed and will work in all browsers.

One consideration - this will add to the page size, so if bandwidth and performance are concerns, try to limit the amount of whitespace you use.