-2

Many people assumes that single quote is invalid (including me) but seeing different answers on this regards seems we can use single quote for html attributes.

But when I tested writing a page with single quote attribute for the html I found browsers rendering double quotes for the html attributes(by inspecting).

So, there might be slow on complex website because it renders html correctly after replacing single quote to double quote.

What is your final decision to write single quote vs double quote.

This question is merely opinion based question but I've asked this question because many will benefit from this if it really useful not to use single quote?

Navin Rauniyar
  • 10,127
  • 14
  • 45
  • 68
  • I assume your inspection tool (firebug?) replaces these quotes, because the source code of the page remains unchanged and I doubt the browsers are replacing anything here. If single quotes would be invalid it would throw at least a warning on page validation. -- http://jsfiddle.net/75NC3/ – Smamatti Aug 06 '14 at 08:44
  • possible duplicate of [Single vs Double quotes (' vs ")](http://stackoverflow.com/questions/2373074/single-vs-double-quotes-vs) – Danield Aug 06 '14 at 08:44
  • http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 – Mad Angle Aug 06 '14 at 08:46

1 Answers1

1

The decision about which type of quote to use largely comes down to:

  • Double quotes are, arguably, easier to see
  • Double quotes are the conventional choice
  • Different quotes interact differently with tools that might be used to generate HTML (e.g. most programming languages use them to delimit string literals so if you have HTML embedded in a string literal it might be easier to use one or the other of the two characters)
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335