Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single versus double quotation marks in HTML & CSS [duplicate]

Could anyone clarify the difference between single and double quotation marks in HTML5 & CSS.

Here's Google's contradictory use of single quotes in HTML:

<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

And CSS:

font-family: 'Roboto', sans-serif;

While Bootstrap's documentation practices demonstrate the use of double quoted marks in HTML:

<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css">

And CSS:

font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;

Which practice is the best and why ?

EDIT: Is there any valid reason why Google Fonts decided to use single quotes ?

like image 638
vorststoom Avatar asked Nov 13 '15 16:11

vorststoom


2 Answers

Either are valid, but you probably should stick to a certain style guide. For example, Google's style guide suggest using double quotes for HTML and single quotes for CSS. (Although Google Fonts doesn't follow this exactly)

like image 85
cocoa Avatar answered Oct 25 '22 08:10

cocoa


There's no best practice, because neither has any affect at all on how the code is parsed. You can deliminate attributes and other strings using ' or " interchangeably.

like image 38
Aeolingamenfel Avatar answered Oct 25 '22 07:10

Aeolingamenfel