IE Underscore Bug Test
HTML Specification does not allow use of a number in a class or id, it is suggested that you preceed a leading number with an underscore (_). Windows IE does not obey the rules set for a class or id beginning with an underscore.
- Example 1: Underscore in
class -
- Style Applied
span.rating { border: 1px solid #fff; background: url(stars.jpg) top left repeat-x; display: block; height: 19px; text-indent: -999em; } span._2 { width: 42px; }- Code
<dl> <dt>Your Rating:</dt> <dd><span class="rating _2">2 Stars</span></dd> </dl>- Example
-
- Your Rating:
- Example 2: Underscore in
id -
- Style Applied
span.rating { border: 1px solid #fff; background: url(stars.jpg) top left repeat-x; display: block; height: 19px; text-indent: -999em; } span#_2 { width: 42px; }- Code
<dl> <dt>Your Rating:</dt> <dd><span id="_2" class="rating">2 Stars</span></dd> </dl>- Example
-
- Your Rating:
- Solution
- None as of now… suggested that you avoid using an underscore to lead a
classorid.