[RESOLVED] PNG background-image url doesn't show in firefox-VBForums
Results 1 to 7 of 7

Thread: [RESOLVED] PNG background-image url doesn't show in firefox

  1. #1

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,491

    Resolved [RESOLVED] PNG background-image url doesn't show in firefox

    I can't get the blue background image to show in Firefox; it just shows the red border without the blue rectangle image inside it. It's showing correctly in Chrome/IE/Opera. Firefox has no problems showing the background image when I run from a local file (file://) but has problems when I view from Apache or IIS webserver. Can anyone explain what might be going wrong? There is also no problems when the background image url is switched to placehold.it png image.

    HTML Code:
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <title>Test</title>
    5. <meta charset="utf-8"/>
    6. <style type="text/css">
    7. body > div {
    8.     /*background-image: url('http://placehold.it/800x150.png');*/
    9.     background-image: url('test-800x150.png');
    10.     background-repeat: no-repeat;
    11.     min-height:300px;
    12.     width: 1000px;
    13.     border: 1px solid red;
    14. }
    15. </style>
    16. </head>
    17. <body>
    18. <div>
    19.     test
    20. </div>
    21. </body>
    22. </html>
    Attached Images Attached Images  
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PNG background-image url doesn't show in firefox

    Make sure the path is correct? A relative path like that means that test-800x150.png has to be in the same directory as the HTML file you're opening.

    If this exact code is not working and the file is in the same directory as the HTML file, then I'm not sure what to tell you.
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,491

    Re: PNG background-image url doesn't show in firefox



    I renamed the file from 'test-800x150.png' to 'test.png' and it's now working. I can't explain it, because I've used the same layout on another site with a background-image url and that didn't have problems.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  4. #4
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    11,476

    Re: PNG background-image url doesn't show in firefox

    Quote Originally Posted by tr333 View Post


    I renamed the file from 'test-800x150.png' to 'test.png' and it's now working. I can't explain it, because I've used the same layout on another site with a background-image url and that didn't have problems.
    Maybe firefox can not read file names when they are long an a certain length, if I remember correctly the value is 8.3 which is a maximum of eight characters before the "." after three after before problems start to occur.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    DON'T BUMP YOUR POSTS!!! Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  5. #5

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,491

    Re: PNG background-image url doesn't show in firefox

    Quote Originally Posted by Nightwalker83 View Post
    Maybe firefox can not read file names when they are long an a certain length, if I remember correctly the value is 8.3 which is a maximum of eight characters before the "." after three after before problems start to occur.
    8.3 filename limitations haven't existed for years, so I would be surprised if that caused any issues.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  6. #6
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    11,476

    Re: [RESOLVED] PNG background-image url doesn't show in firefox

    Maybe so but to make sure nothing goes wrong it is best to keep to that format. Like Occam's Razor suggests the simplest solution is usually the best.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    DON'T BUMP YOUR POSTS!!! Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  7. #7
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [RESOLVED] PNG background-image url doesn't show in firefox

    Quote Originally Posted by Nightwalker83 View Post
    Maybe so but to make sure nothing goes wrong it is best to keep to that format. Like Occam's Razor suggests the simplest solution is usually the best.
    Usually, that might be reasonable, but this was a limit made by the operating system, not a browser, and it was pre-Windows 95. That was 16 years ago. This limitation does not exist anymore.
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.