{-ms-behavior} Trident Vendor-Prefixed Property | CSS: Presentation Layer

Standards Based Development

Multiple behaviors can be applied to a single element by specifying a space-delimited list of urls for the -ms-behavior attribute, as shown below:


<element style="behavior:url(a1.htc) url(a2.htc) ...">

Conflicts resulting from applying multiple behaviors on an element are resolved based on the order in which the behavior is applied to the element. Each succeeding behavior takes precedence over the previous one, for example, if multiple behaviors are setting an element's color, the prevailing color is the one set by the behavior last applied to the element. The same rule applies when resolving naming conflicts.

Note: once --ms-behavior is defined for the element, the addBehavior method can be used to dynamically attach additional behaviors to the element.

The behavior example below implements an expanding and collapsing table of contents by applying the behavior as an inline style to the li element. Two behaviors implemented as htc have been applied to the element to achieve a combination of mouseover highlighting and expanding/collapsing effect:


<ul>
  <li style="behavior:url(ul.htc) url(hilite.htc)">HTML</li>
    <ul>
      <li>Internet Explorer authoring tips</li>
	  :
    </ul>
  </li>
</ul>

References and Resources