【发布时间】:2010-10-22 05:51:56
【问题描述】:
我很难弄清楚为什么 Firefox3.1 在测试元素上返回 'content' 的值,而 Safari 4 不会。
我的示例页面设置如下:
<style>
#asd{
content: 'test';
}
</style>
<div id="asd">
Bleh
</div>
我的 JS 正在使用 getComputedStyle。这适用于“背景颜色”等其他属性,但不适用于“内容”:
if( window.getComputedStyle ){
var thestyle = window.getComputedStyle( document.getElementById('asd'), '');
alert( thestyle.getPropertyValue('content') );
}
Safari 对伪元素选择器 :before 和 :after 的限制是否更严格?我用 :after 测试过,也失败了,而 FF 成功返回数据。
【问题讨论】:
标签: css safari css-content