2

I have just created an HTML5 page with a background image in the top center.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Example</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <p>Example</p>
    </body>
</html>

With the following CSS:

body 
{
    background-image: url('images/bg.png');
    background-position: top center;
    background-repeat: no-repeat;
    margin: 0;
    padding: 36px 0 0 0;
}

But I have spotted a problem in Firefox 12.

No matter how much I shrink the browser window, the HTML element never falls below 376px. This causes the background position to no longer appear in the center, but instead it looks like it is right-aligned (and then crops the right-hand portion of the image).

In Chrome, Opera and Internet Explorer it works as expected, but in Firefox I get this strange behaviour. I have added a screenshot of all four browsers showing this page.

UPDATE

This seems to be related to the size of the toolbar in the browser as the width it stops at is identical to the width of the browser toolbar. A colleague has just tried it and his toolbar is 427px and it stopped at this value. I presume this is a Firefox bug.

Firefox HTML element larger than browser window

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • I can reproduce this only on the Windows version of FF12. Doesn't happen on Linux. Then I searched Bugzilla, but haven't found any match. – Mr Lister May 25 '12 at 14:30
  • Where the css for the blue box??? – Larry Battle May 25 '12 at 14:36
  • The blue box is the sample background image. All the HTML and CSS is in the post - there are no secrets. – Fenton May 25 '12 at 14:57
  • Could you post your code on jsbin.com or jsfiddle.net? Here's what I got. http://jsbin.com/iyugud/ – Larry Battle May 25 '12 at 15:15
  • It won't work on JS Fiddle as they put the contents into an iframe, but I have updated your JS Bin example to use a smaller background image so you can see the behaviour: http://jsbin.com/iyugud/4 – Fenton May 28 '12 at 07:25

3 Answers3

0

Your code shrinks properly in Firefox 12 for me.

I think it's one of your addons causing the problem. So you might want to disable a few and see if the problem goes away.

Also, try running Firefox in safe-mode and seeing if the problem exist.

"C:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode
Larry Battle
  • 9,008
  • 4
  • 41
  • 55
0

I think I resloved problem with Firefox. Check my answer to the same topic here and give me feedback if it was helpful ;) I don't want to paste the same answer in two places ;)

Community
  • 1
  • 1
Sófka
  • 983
  • 7
  • 12
  • That is a great description of the problem, but isn't really a solution. There is no way I'm adding a message "Please hide your Firefox toolbar to view this website". – Fenton Jun 08 '12 at 11:21
  • I thought you need it to test for mobiles :) But if you must show your website for smaller widths you can detect browser (FF) and then hide toolbar with Java Script ;) Just add listener to event on resize window and under 500px (or 450px) hide toolbar. – Sófka Jun 08 '12 at 11:27
0

It looks like this is a genuine bug in Firefox, so I have raised a bug.

Fenton
  • 241,084
  • 71
  • 387
  • 401