If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

in CSS before: elements don't float

VERIFIED INVALID

Status

()

Core
CSS Parsing and Computation
--
minor
VERIFIED INVALID
16 years ago
16 years ago

People

(Reporter: Sven Heinicke, Assigned: Pierre Saslawsky)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
p.first:before {
 content: "ABC";
 font-size: 200%;
 vertical-align: top;
 border: 1px solid white;
 float: left;
}

The above box causes "ABC" to appear on top of the paragraph rather then
floating it to the left.
From the CSS spec on floats (http://www.w3.org/TR/REC-CSS2/visuren.html#floats):

  A floated box must have an explicit width (assigned via the 'width' property,   
  or its intrinsic width in the case of replaced elements). Any floated box
  becomes a block box that is shifted to the left or right until its outer edge
  touches the containing block edge or the outer edge of another float.

In your case, the float has no width set and so defaults to width auto and is
the width of the content area (put a visible border on the float to see this). 
Adding a width of 2em or something like that (so it scales with font) will
completely fix your problem....

Marking invalid -- we lay this out per the spec.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID
And more importantly:

# 9.5.1 Positioning the float: the 'float' property
# 'float' 
# Applies to:   all but positioned elements and generated content 
  ^^^^^^^^^^    ^^^^^^^                         ^^^^^^^^^^^^^^^^^

VERIFIED INVALID.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.