Closed Bug 292404 Opened 20 years ago Closed 19 years ago

background-position only centers horizontally

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: marcelo.polli, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050429 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050429 Firefox/1.0+

The center parameter in the background-position CSS property is supposed to
center an element both horizontally AND vertically, as described in the W3C
specification for that property: http://www.w3.org/TR/REC-CSS1#background-position

However, the same property in the current nightly is only centering objects
horizontally but not vertically.

Reproducible: Always

Steps to Reproduce:

Actual Results:  
The image that received the background-position CSS property was only
horizontally centered, remaining at the top of the browser window.

Expected Results:  
The background image should have been vertically as well as horizontally centered.
Severity: major → normal
Version: unspecified → Trunk
The height of the html element is being calculated via its contents. If you add
|height:100%;| to the |html| selector, it renders as you expect.
(In reply to comment #1)

I always assumed the height of the <html> element would be that of the page
itself, since that is the way it works for background-color.

What we have here is an element which is smaller than the visible area yet
extends its background-color to all of the visible area.

I looked up W3C specification pages but the say nothing on that specific
problem. So is this behavior correct or not?
According to http://www.w3.org/TR/CSS21/zindex.html:

 If the element is a root element:
   1. background color of element over the entire canvas.
   2. background image of element, unclipped, painted at the origin that would
be used if it was painted for the root element. 

My understanding of point 2 is that the background is (normally) unclipped, and
will cover the entire canvas background, but is positioned according to the
actual position/size of the root (<html>) element (even though it is painted
onto the canvas). I therefore believe the behaviour described is correct.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.