HTML Coding - Is there a benefit disadvantage to using "quotes" or "apostrophes"? [duplicate]

StackOverflow https://stackoverflow.com/questions/13937870

  •  10-12-2021
  •  | 
  •  

Domanda

Possible Duplicate:
Single vs Double quotes (' vs ")

I just purchased an HTML template built on Twitter Bootstrap. Parts of the template are coded with class='navbar' rather than class="navbar" (notice the apostrophes rather than quotation marks for the class attribute).

Is there a benefit or disadvantage to using apostrophes over quotation marks?

È stato utile?

Soluzione

Nope. You're entirely free to use either.

One of the reasons both exist is so it's less work to work with them in javascript.

var lumpOfHTML="<a href='http://google.com'>Link 1</a>";
var anotherLumpOfHTML='<a href="http://google.com">Link 1</a>';

Both of these will do the same thing.

Altri suggerimenti

It's a personal preference.

BTW: In HTML5 is it allowed to not use quotes eg. class=navbar if te value is 1 word

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top