This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 154 - Warn for floated elements without intrinsic width
Summary: Warn for floated elements without intrinsic width
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: CSS 1.0 (show other bugs)
Version: CSS Validator
Hardware: Other other
: P5 enhancement
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
Depends on:
Reported: 2003-02-27 16:38 UTC by Philippe Le Hegaret
Modified: 2009-02-04 15:05 UTC (History)
1 user (show)

See Also:

test case (191 bytes, text/css)
2009-02-04 14:50 UTC, Olivier Thereaux

Description Philippe Le Hegaret 2003-02-27 16:38:36 UTC
One thing you'll need to fix is that floated elements must have a width
> declared:
>     <>
elements with intrinsic width include:
html, img, input, textarea, select, and object.

so the following should NOT create a warning:

  float: right;

for non-replaced elements (i.e. elements with no intrinsic width),
could we please issue a warning if no width is given?

for example, the following paragraph rule set SHOULD create a
missing width warning:

  float: right;
Comment 1 Olivier Thereaux 2007-07-19 09:11:29 UTC
Related discussion:
Ā«The problem I see is that the css validator is not tied to HTML. How do we know if img is the html's img tag or something else? We could issue warnings only if we know that a CSS is linked from an HTML documentĀ»

Fair question, although we do know that the main usage of CSS is to style HTML and SVG, and that could remain a  decent assumption. Do we still have a list of html elements?
Comment 2 Olivier Thereaux 2009-02-03 20:04:25 UTC
I somewhat miraculously managed to add the warning for the general case, but have not yet found how/where I can determine which element selector is applicable. Any pointer?

For reference, the code is in (look for findConflicts )
Comment 3 Olivier Thereaux 2009-02-04 14:50:21 UTC
Created attachment 624 [details]
test case
Comment 4 Olivier Thereaux 2009-02-04 15:05:36 UTC 
seems to have done the trick - the test case validates with a single warning for the <p> but not the <img> selector, which has intrinsic width.