Closed Bug 448169 Opened 16 years ago Closed 16 years ago

letter-spacing or font-size in :first-child on element with float:left - unexpected spacing between it and another float:left element

Categories

(Core :: Layout: Floats, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 385615

People

(Reporter: laogeodritt, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2pre) Gecko/2008072603 Minefield/3.1a2pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2pre) Gecko/2008072603 Minefield/3.1a2pre

Given two left-floated elements on a same line (in such a way that they appear beside each other), if letter-spacing or font-size is changed for the :first-letter of the FIRST element, then the spacing between the first and second floated elements is unexpected.

From what it appears from my playing around with it, the browser is calculating the width of the first element as if the letter-spacing or font-size of the :first-letter applied to the WHOLE of the element's text, even though the rest of the text is rendered as expected.

Please see the test case, which I am uploading shortly. Code might be clearer than my attempt at explaining the situation.

Reproducible: Always

Steps to Reproduce:
1. Take two block elements, floated to the left, in such a way that they're beside each other.
2. Apply a CSS :first-child rule to the leftmost element, and change the font-size or letter-spacing to differ from the rest of the text. (Use something substantially different to see it more clearly.)
3. Observe the position of the second floated element relative to the first (leftmost) floated element.
Actual Results:  
If you increase the font-size or letter-spacing of the :first-letter of the first element, there is an unexpected horizontal space between the two elements.

Conversely, decreasing either will cause the second element to overlap the first element (or become nearer than expected, given less substantial changes).

Expected Results:  
In both cases, the two elements are expected to be right one another, unless other positional properties are applied.
Here are a few test cases that should demonstrate this. Never mind the nonsense I used in it.

Also, I'd like to know that although I've marked this Windows, I don't have the means of testing this under any other OS.
Oh, another note, the positioning corrects itself if I zoom either way, or if I make a change relating to the elements in Firebug and change it back. It seems to only occur on the initial load/draw of the page.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: