Proper syntax for background: url();

Discussion in 'HTML' started by Joshua Beall, Apr 7, 2004.

  1. Joshua Beall

    Joshua Beall Guest

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

    ?
     
    Joshua Beall, Apr 7, 2004
    #1
    1. Advertising

  2. Joshua Beall wrote:

    > 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
     
    Weyoun the Dancing Borg, Apr 7, 2004
    #2
    1. Advertising

  3. Joshua Beall

    Steve Pugh Guest

    "Joshua Beall" <> wrote:

    >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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Apr 7, 2004
    #3
  4. Joshua Beall

    brucie Guest

    in post: <news:VkTcc.6194$>
    "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?


    the quotes are optional but if used you can use single or double.

    http://www.w3.org/TR/REC-CSS2/syndata.html#uri


    --
    b r u c i e
     
    brucie, Apr 7, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    947
  2. D. Alvarado

    Generating the proper url

    D. Alvarado, Oct 25, 2004, in forum: Java
    Replies:
    0
    Views:
    297
    D. Alvarado
    Oct 25, 2004
  3. Shea Martin
    Replies:
    2
    Views:
    491
    Gianni Mariani
    Nov 18, 2003
  4. Neil
    Replies:
    11
    Views:
    518
  5. Just D.
    Replies:
    0
    Views:
    551
    Just D.
    Aug 11, 2004
Loading...

Share This Page