Proper syntax for background: url();

J

Joshua Beall

Hi All,

What is the proper syntax for background: url();? Specifically, should the
url be single quoted, double quoted, or not quoted at all? IE6 and Mozilla
1.5 seem to work fine with any of those options, but I am wondering what the
"correct" way to do this is:

background: url('back.gi');
background: url("back.gif");
background: url(back.gif);

?
 
W

Weyoun the Dancing Borg

Joshua said:
Hi All,

What is the proper syntax for background: url();? Specifically, should the
url be single quoted, double quoted, or not quoted at all? IE6 and Mozilla
1.5 seem to work fine with any of those options, but I am wondering what the
"correct" way to do this is:

background: url('back.gi');
background: url("back.gif");
background: url(back.gif);

?
http://www.w3schools.com/css/css_background.asp
 
S

Steve Pugh

Joshua Beall said:
What is the proper syntax for background: url();? Specifically, should the
url be single quoted, double quoted, or not quoted at all? IE6 and Mozilla
1.5 seem to work fine with any of those options, but I am wondering what the
"correct" way to do this is:

background: url('back.gi');
background: url("back.gif");
background: url(back.gif);

They're all correct. See http://www.w3.org/TR/CSS2/syndata.html#uri

Whilst IE3 was buggy and only understood URLs without any quotes I'm
not aware of any problems with the various formats in current
browsers, (with regards to background-image, there are bugs relating
the syntax used when the URL is part of an @import).

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top