[XHTML2WD5] Ilegal CSS Example

9.7. The l element

| <p class="program">
| <l>program p(input, output);</l>
| <l>begin</l>
| <l>   writeln("Hello world");</l>
| <l>end.</l>
| </p>

|  .program { counter-reset: linenumber }
|  l:before {
|    position: relative;
|    left: -1em;
|    counter-increment: linenumber;
|    content: counter(linenumber);
|  }

At least in CSS 2.0 generated content can't be positioned. In CSS3 it would
be "l::before". Also "counter(linenumber, decimal-leading-zero);" might be
more appropriate. With the introduction of 'blockcode' it should be used
here:

 <blockcode>
 <l>begin</l>
 <l>   writeln("Hello world");</l>
 <l>end</l>
 </blockcode>

 blockcode {counter-reset: linenumber;}
 l::before {
   counter-increment: linenumber;
   content: counter(linenumber, decimal-leading-zero);
 }

Christoph Päper

Received on Thursday, 8 May 2003 18:26:50 UTC