SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to write background-image correctly

    I know I've seen this here in the forums but for the life of me I can't seem to find it. Maybe someone here can help me out.

    When you define a background-image:url(imageurl);, how do you write the url so it is relative? The obvious ansers, such as just writing url(image.jpg); or url(/images/image.jpg); don't seem to work.

    Thanks.
    Sketch
    Aaron Brazell
    Technosailor



  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I always use:
    background-image: url('images/images.jpg');
    Wayne Luke
    ------------


  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah!
    That would do it...

    Thanks, Wayne.

    Sketch
    Aaron Brazell
    Technosailor



  4. #4
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not intending to contend here, however, the correct way should be background-image : url(images/images.jpg) ; (keeping in mind the spaces are optional). Quotes aren't needed.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  5. #5
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know guys, you can always check the spec. :-p

    P.S. Quotes are optional. Remember, URLs in the stylesheet are relative to it, not the document using the stylesheet. Of course, that's unless the style rules are in the document itself and not just linked.

    ~~Ian

  6. #6
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I know the quotes are optional in this case. However it is my own personal preference to enclose variable constants like that in quotes if allowed. It makes my work cleaner in my opinion.
    Wayne Luke
    ------------


  7. #7
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Colin...

    I tried it without quotes unsuccessfully (don't know why if that's the proper way). That's why I posted here.

    Sketch
    Aaron Brazell
    Technosailor




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •