Jump to content

background-position in firefox


chadmichael

Recommended Posts

I used the following in firefox to style a background image for my body.

body {background: #999 url(images/snowyGate.jpg) no-repeat scroll right bottom;}

The positioning aspect of this seems to fail. It failed also when I used the background-position attribute as distinct from the background shorthand notation. Does background positioning work in firefox?

Link to comment
Share on other sites

Okay, so I figured out some more details about the behavour that I am seeing. Im pretty sure its not a bug but its a behaviour :) to be sure. In the following code sample, I have a page that has just a single line of conent, but an embedded style centers a non-tiled image for the body's background. This code works but you have to supply your own image.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>background positioning bug</title><style type="text/css">		 body {background: #919 url(images/snowyGate.jpg) no-repeat center; }</style></head><body >	Not much to say.</body></html>

If you try it out, the image will be centered horizontally, but vertically it is centered to the center of the single line of text. It seems that if the body's content doesn't have much size, in the vertical dimension, then the body size ( to which the background image is positioned ) is only the height of the body's content. So, it seems to me that the body is only the height of the content?? Can someone explain the logic behind this behaviour? I kind of knew this was the behaviour for a div but I would have thought that the body element would have taken up the whole browser viewport by default.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...