Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which type of quotes we should use in css background url ("....")? Single, double or no quote needed? [duplicate]

Tags:

css

grammar

this

background:url(http://url);

this

background:url("http://url");

or this

background:url('http://url');
like image 999
Jitendra Vyas Avatar asked Sep 08 '25 16:09

Jitendra Vyas


1 Answers

The URL bits of all three of your examples are valid CSS, according to the CSS specification.

Note that the spec identifies some characters in a URL which will need to be escaped with a backslash if present in an unquoted URI, such as parentheses, commas, white space characters, single quotes (') and double quotes ("). For this reason, you might find it better to use single or double quotes around your URLs.

Note that you need to write your full CSS property in the format:

background: url( http://example.com );
like image 80
Dexter Avatar answered Sep 10 '25 07:09

Dexter