'What is behavior: url(); property in css?
I was surfing and saw this css property which I have never seen or used before. I think it is related to Internet Explorer, and the structure is something like this:
#element{
behavior: url(something.htc);
}
What does the behavior
property do? How would I use this property?
I did find this w3 Documentation, but it's not particularly clear what it does.
Solution 1:[1]
It is Microsoft Extensions to CSS
.htc files are commonly used in .css files using an IE specific property called behavior, using this along with the .htc file allows the browser to run JavaScript code which is whats contained within the file.
what it does?
Sets or retrieves the location of the Dynamic HTML (DHTML) behaviorDHTML Behaviors.
.htc Extention
The script resides in an HTC (HTML Component) file. HTC files have the extension .htc, and are HTML files that contain a script plus a set of HTC-specific elements that define the components.
- History of behavior
Syntax
behavior: url(sLocation) | url(#objID) | url(#default#behaviorName)
Property values
url(sLocation)
- Script implementation of a DHTML behavior, where sLocation is an absolute or relative URL.
url(#objID)
- Binary implementation of a DHTML behavior, where objID is the ID attribute specified in an object tag.
url(#default#behaviorName)
- The application's default behavior, identified by its behaviorName.
Useful Links
Microsoft says it is no longer supported in IE 10!
Solution 2:[2]
It lets you use CSS to attach a script to a specific element in order to implement DHTML (Dynamic HTML) components.
Internet Explorer versions 5 and later support the behavior property. Internet Explorer 8 supports Vendor specific format of -ms-behavior
For more info. refer this link.
Solution 3:[3]
Nâo utilize esta propriedade "behavior", pois ela é xclusiva para o IE antigos os demais navegadores não existe.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Community |
Solution 2 | Suresh Karia |
Solution 3 | jacivam_aps |