Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Quotation Marks Should I Use In CSS? [duplicate]

Possible Duplicate:
Which type of quotes we should use in css background url (“…”)? Single, double or no quote needed?

Simple question. What quotation marks should I use in CSS?

Option #1:

background: url( 'foo.png' );

Option #2:

background: url( "foo.png" );

Both works on "normal browsers". I just want to follow the standards.

like image 309
daGrevis Avatar asked Apr 16 '11 17:04

daGrevis


People also ask

How do I use double quotes in CSS?

Double quotes on the first quote, single quotes on the second. A quote with French quotes. You can place as many pairs of quotes in the quotes property as you like. But you don't have to put more than two, because for every extra quote it simply repeats the quotes values from the beginning.

Should I use single or double quotes coding?

Both single (' ') and double (" ") quotes are used to represent a string in Javascript. Choosing a quoting style is up to you and there is no special semantics for one style over the other. Nevertheless, it is important to note that there is no type for a single character in javascript, everything is always a string!

Can I use single quotes in CSS?

They are interchangeable. The only important note is not to use one inside itself.

What is the difference between single and double quotation marks in coding?

The main difference between double quotes and single quotes is that by using double quotes, you can include variables directly within the string. It interprets the Escape sequences.


1 Answers

The standards say:

The format of a URI value is 'url(' followed by optional white space followed by an optional single quote (') or double quote (") character followed by the URI itself, followed by an optional single quote (') or double quote (") character followed by optional white space followed by ')'. The two quote characters must be the same.

i.e. none, single or double. If you care about IE5/Mac (which you probably don't these days) avoid ', otherwise use whatever makes you comfortable.

like image 71
Quentin Avatar answered Nov 23 '22 17:11

Quentin