HTML and CSS   XSLT   JavaScript   Images   Soft   Etc  
Vladimir Tokmakov

Editing HTML text using CSS 14 October 2005


Internet Explorer is required to view this example.

Task:

Emulate CSS content property in IE.

Use IE built-in command expression.

How it looks in the browser

  • item®
  • —this item already has a dash
  • but this way—it’s no good

01 
02 
03 
04 
05 
06 
07 
08 
09 
10 
11 
12 
13 
14 
15 
16 
17 
<style type="text/css">
    ul.example { margin: 0.5em 0; padding: 0 0 0 2em; }
    ul.example li
    {
        margin: 0.5em 0; padding: 0 0 0 20px;
        list-style-type: none;
        behavior: expression( !this.before
            ? this.before = this.innerHTML = '&mdash;&nbsp;' + this.innerHTML : '' );
        text-indent: -1.24em;
    }
    ul.example li:before { content: '\2014\a0'; }
</style>
<ul class="example">
    <li>item<sup>&reg;</sup></li>
    <li> &mdash;this item already has a dash</li>
    <li><p>but this way&mdash;it&#146;s no good</p></li>
</ul>

Order a design...