Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Background image with space in the file name problem

    Basically, I am trying to get logos to come up for various suppliers. The brand names are pulled from the backhand, and I have to use a custom token.

    eg.
    <div style="background: url([CSS:ProductBrandName:].gif) no-repeat; position: relative; width: 170px; float: right; height: 50px"></div>

    So [CSS:ProductBrandName:].gif gets replaced by, say, Cambridge Audio.gif.

    However, as a background image this does not work in firefox. In internet explorer it does.
    If I use <img src="[CSS:ProductBrandName:].gif" /> it works. But not as a background image, and not in Firefox.

    Any idea? I need to have it as a background image so users don't get a no image icon if there's no actual logo file.

    Thanks.

  • #2
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah! Stupid me, it was the lack of an apostrophe enclosing the url. All fixed now. Just in case anyone else has a problem I'll leave this threat posted.

    Bad:
    Code:
    background: url(files/web_logos/[CSS:ProductBrandName:].gif)
    Good:
    Code:
    background: url('files/web_logos/[CSS:ProductBrandName:].gif')

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by mversion View Post
    Basically, I am trying to get logos to come up for various suppliers. The brand names are pulled from the backhand, and I have to use a custom token.

    eg.
    <div style="background: url([CSS:ProductBrandName:].gif) no-repeat; position: relative; width: 170px; float: right; height: 50px"></div>

    So [CSS:ProductBrandName:].gif gets replaced by, say, Cambridge Audio.gif.

    However, as a background image this does not work in firefox. In internet explorer it does.
    If I use <img src="[CSS:ProductBrandName:].gif" /> it works. But not as a background image, and not in Firefox.

    Any idea? I need to have it as a background image so users don't get a no image icon if there's no actual logo file.

    Thanks.
    it's obvious, the solution is to change the names to make them normal. Each os have it's conventions for filenames, you can't ignore this.

    Edit: I miss the missing quote, This fix the problem for css but will get other problems later with other things. The best solution finaly is to change names

    best regards.
    Last edited by oesxyl; 11-17-2009 at 02:00 AM.


  •  

    Posting Permissions

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