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

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

  •  10-12-2021
  •  | 
  •  

Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

It's a personal preference.

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top