What Quotation Marks Should I Use In CSS?

daGrevis picture daGrevis · Apr 16, 2011 · Viewed 9.7k times · Source

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.

Answer

Quentin picture Quentin · Apr 16, 2011

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.