我已经在css文件中读/写了Font_face规则和样式规则的属性。
使用 cssutils 0.9.6 版本和 python 编程语言。
我尝试阅读,访问页面规则的属性。
但它给读取 page_rule 样式表中的属性带来了问题。页面规则中的属性将类型指定为未知规则。
那么如何读取页面规则的属性
我在解析 css 文件时得到了 selectorText/class name as :blank property.atkeyword as @top-left @top-center
但是没有得到属性即那些属性的内容和值?
对于 ex 作为 css 文件中的行:
@page:blank {
@top-left {
content: normal;
}
@top-center {
content: normal;
}
}
我想正常读取属性内容和值,所有这些都使用 cssutils 而不是使用正则表达式
最佳答案
css page rule 的语法选择器是:
@page [identifier][:(first|left|right)]
所以问题中给出的示例是无效的,因为“空白”不是伪页面
。
你的意思可能是:
@page blank {
@top-left {
content: normal;
}
@top-center {
content: normal;
}
}
哪个 cssutils
正确解析。
关于python - 使用 cssutils 访问或读取页面规则的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8486877/