< css‎ | properties(Redirected from css/media queries/behavior)
Jump to: navigation, search


This article is In Progress.


Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior.

Overview table

Initial value
Applies to All elements
Inherited No
Media visual
Computed value
Animatable No
CSS Object Model Property


  • !important: declaration
  • -ms-flex-pack: center
  • -ms-flex-pack: end
  • -ms-flex-pack: justify
  • -ms-flex-pack: start
  • align-content: center
  • align-content: flex-end
  • align-content: flex-start
  • align-content: space-around
  • align-content: space-between
  • align-content: stretch
  • align-items: baseline
  • align-items: center
  • align-items: flex-end
  • align-items: flex-start
  • align-items: stretch
  • align-self: auto
  • align-self: baseline
  • align-self: center
  • align-self: flex-end
  • align-self: flext-start
  • align-self: stretch
  • alignment-adjust: <length>
  • alignment-adjust: <percentage>
  • alignment-adjust: after-edge
  • alignment-adjust: alphabetic
  • alignment-adjust: auto
  • alignment-adjust: baseline
  • alignment-adjust: before-edge
  • alignment-adjust: central
  • alignment-adjust: hanging
  • alignment-adjust: ideographic
  • alignment-adjust: mathematical
  • alignment-adjust: middle
  • alignment-adjust: text-after-edge
  • alignment-adjust: text-before-edge
  • all-space-treatment: collapse
  • all-space-treatment: preserve
  • animation-delay: <time>
  • animation-direction: alternate
  • animation-direction: alternate-reverse
  • animation-direction: normal
  • animation-direction: reverse
  • animation-duration: <time>
  • animation-fill-mode: backwards
  • animation-fill-mode: both
  • animation-fill-mode: forwards
  • animation-fill-mode: none
  • animation-iteration-count: <single-animation-iteration-count>
  • animation-iteration-count: infinite
  • ... further results




[This example implements an expanding and collapsing table of contents by applying the behavior as an inline style to the li element. In this case, two behaviors implemented as HTC have been applied to the element to achieve a combination of mouseover highlighting and expanding/collapsing effect. View live example]The following examples demonstrate various ways of applying the -ms-behavior property on a page.


  <li style="behavior:url( url(">HTML</li>
      <li>Internet Explorer authoring tips</li>

This example defines the -ms-behavior attribute in a separate style block.


   .CollapsingAndHiliting {behavior:url( url(} 
  <li class="CollapsingAndHiliting">HTML</li>
      <li>Internet Explorer authoring tips</li>

View live exampleThis example sets the -ms-behavior property in script.


   function window.onload()
   { = "url( url(";
  <li id=idTopic1>HTML Authoring</li>
      <li>Internet Explorer authoring tips</li>

If the expanding/collapsing example were to use a DHTML behavior implemented in C++ as an ActiveX control, the code would look slightly different. In this example, the -ms-behavior attribute points to the id property of the object specified in the object element.


   .Collapsing { behavior:url(#myObject) }
<object id=myObject ... ></object>
  <li class="Collapsing">HTML Authoring</li>
      <li>Internet Explorer authoring tips</li>



You can apply multiple behaviors to an element by specifying a space-delimited list of URLs for the -ms-behavior attribute, as shown in the following syntax:

<element style="behavior:url( url( ..." >

In the following section, one example demonstrates how you can apply two behaviors to an element to achieve a combination of effects. Conflicts resulting from applying multiple behaviors to 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 behavior. For example, if multiple behaviors set the element's color, the prevailing color is the one set by the behavior last applied to the element. The same rule applies in resolving name conflicts, such as with property, method, or event names exposed by multiple behaviors. Once the -ms-behavior property is defined for the element, the addBehavior method can be used to dynamically attach additional behaviors to the element. Note  A behavior attached to an element by using the addBehavior method or by applying the proposed Cascading Style Sheets (CSS) -ms-behavior attribute inline is not automatically detached from the element when the element is removed from the document hierarchy. However, a behavior attached using a style rule defined in the document is detached automatically as the element is removed from the document tree. Windows Internet Explorer 8. The -ms-behavior attribute is an extension to CSS, and can be used as a synonym for behavior in IE8 Standards mode.


-ms-behavior: url(sLocation) | url(#objID) | url(#default#behaviorName)



Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? ? ? ? ?


Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?

See also

Related articles

Media Queries

  • behavior

Related pages (MSDN)


This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]