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

css, grammar

Solution

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 );

Problem

this ``` background:url(http://url); ``` this ``` background:url("http://url"); ``` or this ``` background:url('http://url'); ```

Original source

Related problems