You are here: Reference > CSS > properties > behavior

behavior property

Browser support:
Sets the URL of a behavior file.
With the behavior property you can attach HTA or HTC files to style declarations. These files are useful to create custom elements, with custom functionality. For more information, visit the behavior (MSDN) page.
JavaScript page for this property: behavior. You can find other example(s) there.

Possible values:

 Any of the following values (use the space character to separate them, each value can be used arbitrary times): 
url(#default#behaviorName)
Where behaviorName specifies the name of an Internet Explorer default behavior.
url(#objID)
Where objID specifies the value of an object element's id attribute.
url(URI)
Where URI specifies the location of the behavior file.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the behavior property:
Code
hover.htc
<head>
    <style>
        .example {
            behavior: url("hover.htc")
        }
    </style>
</head>
<body>
    <span class="example">Move the mouse over this text (element with behavior)</span><br />
    <span>Move the mouse over this text (element without behavior)</span>
</body>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content