Closed Bug 68566 Opened 24 years ago Closed 24 years ago

css does not parse styles with underscores in the names

Categories

(Core :: Layout, defect)

PowerPC
Mac System 9.x
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: phil, Assigned: clayton)

References

()

Details

When a style sheet has a class definition where the name has an underscore
character "_", Mozilla ignores the style.  For example, if the following style
is defined:

.verdana_fixed_10 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px }

it will not be displayed properly.  On the other hand, if the same style is
defined without the underscore, it will be displayed correctly

.verdana10 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px }
Underscores are not allowed in class names by the CSS specification.  They are
reserved for future extensions to the language. Reference:
http://www.w3.org/TR/REC-CSS2/syndata.html#q4

Quote:

 In CSS2, identifiers  (including element names, classes, and IDs in selectors)
can contain only the characters [A-Za-z0-9] and ISO 10646 characters 161 and
higher, plus the hyphen (-); they cannot start with a hyphen or a digit. They
can also contain escaped characters and any ISO 10646 character as a numeric
code (see next item).

As you can see, underscores are not in the list of characters allowed in class
names.  So Mozilla is behaving correctly in ignoring syntactically incorrect CSS
rules.

Marking invalid.  You should replace underscores in your class names with a
legal character (a dash ('-') is good).
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
QA Contact: gerardok → ian
Resolution: --- → INVALID
verified
Status: RESOLVED → VERIFIED
SPAM. HTML Element component is deprecated, changing to Layout component. See
bug 88132 for details.
Come on Bugzilla, you can do it...
Component: HTML Element → Layout
You need to log in before you can comment on or make changes to this bug.