我在网上冲浪时看到了这个我以前从未见过或使用过的 css 属性。我认为它与 Internet Explorer 有关,结构是这样的:
#element{
behavior: url(something.htc);
}
behavior
属性有什么作用?我将如何使用此属性?
我确实找到了这个 w3 Documentation , 但它的作用并不是特别清楚。
最佳答案
Microsoft 对 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.
它有什么作用?
设置或获取 Dynamic HTML (DHTML) behaviorDHTML Behaviors 的位置.
.htc 扩展名
脚本驻留在 HTC(HTML 组件)文件中。 HTC 文件的扩展名为 .htc,是包含脚本和一组定义组件的 HTC 特定元素的 HTML 文件。
- History of behavior
语法
行为:url(sLocation) |网址(#objID) |网址(#default#behaviorName)
属性值
网址(sLocation)
- DHTML 行为的脚本实现,其中 sLocation 是绝对或相对 URL。
网址(#objID)
- DHTML 行为的二进制实现,其中 objID 是对象标记中指定的 ID 属性。
url(#default#behaviorName)
- 应用程序的默认行为,由其行为名称标识。
有用的链接
Microsoft says it is no longer supported in IE 10!
关于css - 什么是行为 : url(); property in css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26339276/