Do you quote HTML5 attributes?

I do quote all attributes and will continue to do so. Primarily because it visually distinguishing where the attribute value starts and stops.

Additionally, it just makes sense for portability and compatibility reason. Though the quotes are optional in HTML[5], they are not optional in XHTML. You have a lot of tedious work to do if you need to convert your documents to XHTML (say, to display SVG on Webkit browsers). We really don't need to dredge up the XHTML v. HTML debate, but it seems like too little hassle to not quote your attributes.

Saving a few bytes in the document body is nigh insignificant when you're downloading kilobytes and kilobytes of images and JavaScript libraries.


I'm in favour of always using quotes.

  • It looks way cleaner and more consistent

  • All editors can deal with it properly

  • It's easier to maintain - you can edit values without breaking them because quotes are missing.

The few bytes you save in document size by dropping quotes where they are not needed are not worth mentioning (unless maybe you're Google's home page).