Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
CSS 供应商前缀(有时也称为 CSS 浏览器前缀)用于 CSS 属性名中,以实现尚未标准化或在某些浏览器中支持有限的试验性或预发布 CSS 功能。换句话说,前缀的存在是为了指定特定浏览器的功能。
从历史上看,浏览器供应商会将前缀用于非标准的 CSS 功能。以下是主要浏览器前缀列表:
根据 CSS 规范,特定于 CSS 供应商的扩展必须以破折号或下划线开头,格式如下:
[’-‘或’_’] + [供应商标识符] + [’-’]+[名称]`。
例如,webkit-text-stroke CSS 属性是一个供应商前缀属性,用于在基于 WebKit 的浏览器中指定文本字符笔画的宽度和颜色,而 moz-border-radius 则是一个供应商前缀属性,可让您在基于 Mozilla 的浏览器(如 Firefox)中对元素的边角进行圆角处理,以创建具有视觉吸引力的现代设计。
Aspose.HTML 库使用的前缀看起来像 -aspose-,可为您提供一些试验性功能。以下是使用 -aspose- 前缀可以启用的 CSS 功能列表:
| Function Name | Description |
|---|---|
| currentPageNumber | This function returns the number of the current rendering page. |
| totalPagesNumber | This function returns the number of the total pages in the document. |
接下来的代码片段演示了如何使用 CSS 扩展来创建自定义的文档页边距标记:
1// How to add custom margin marks using CSS extensions
2
3// Initialize a configuration object and set up page-margins for a document
4using (Configuration configuration = new Configuration())
5{
6 // Get the User Agent service
7 IUserAgentService userAgent = configuration.GetService<IUserAgentService>();
8
9 // Set the style of custom margins and create marks on it
10 userAgent.UserStyleSheet = @"@page
11 {
12 /* Page margins should be not empty in order to write content inside the margin-boxes */
13 margin-top: 1cm;
14 margin-left: 2cm;
15 margin-right: 2cm;
16 margin-bottom: 2cm;
17 /* Page counter located at the bottom of the page */
18 @bottom-right
19 {
20 -aspose-content: ""Page "" currentPageNumber() "" of "" totalPagesNumber();
21 color: green;
22 }
23
24 /* Page title located at the top-center box */
25 @top-center
26 {
27 -aspose-content: ""Hello, World Document Title!!!"";
28 vertical-align: bottom;
29 color: blue;
30 }
31 }";
32
33 // Initialize an HTML document
34 using HTMLDocument document = new HTMLDocument("<div>Hello, World!!!</div>", ".", configuration);
35
36 // Initialize an output device
37 using (PdfDevice device = new PdfDevice(Path.Combine(OutputDir, "output.pdf")))
38 {
39 // Send the document to the output device
40 document.RenderTo(device);
41 }
42}Aspose.HTML 提供 HTML 网络应用程序,它是免费转换器、合并器、搜索引擎优化工具、HTML 代码生成器、URL 工具等的在线集合。这些应用程序可在任何装有网络浏览器的操作系统上运行,无需安装任何其他软件。无论你身在何处,都能轻松转换、合并、编码、生成 HTML 代码,从网络中提取数据,或从搜索引擎优化的角度分析网页。使用我们的 HTML 网络应用程序集来处理您的日常事务,让您的工作流程天衣无缝!
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.