W3C CSS logo Cascading Style Sheets FAQ

home CSS FAQ parent common mistakes

6.1. Do URL's have quotes or not?

No, they don't. But there is one case in CSS1 where an alternative notation with quotes is allowed, viz., in the @import statement (see below).

Here are some examples of correct URL's:

    BODY {background: url(pics/wave.png) blue}
    BLOCKQUOTE {background: url(http://xyz.com/pirate) center}
    @import url(sub/liststyles.css);

Here are some common mistakes:

*   BODY {background: url("pics/wave.png") blue}
*   BLOCKQUOTE {background: "http://xyz.com/pirate" center}
*   @import url('sub/liststyles.css');

The @import statement allows an alternative notation, which does use quotes, but omits the url() part, for example:

    @import "sub/liststyles.css";
    @import '../common.css";


W3C Bert Bos
Webmaster
Last updated 6 Jan 1997