You can set CSS style sheets either by referencing them in your document, setting or adding them using a configuration property, or inline in your document.

Defining a CSS style sheet in the "style" Section of the Document:

<head><style type="text/css">p { color: red; }</style></head>


Referencing an external CSS style sheet using the <link> Element:

<link href="https://someServer/css/layout.css" rel="stylesheet" type="text/css" />


Defining CSS Styles Inline:

<table style="color: red">...</table>


Adding a CSS style sheet using a configuration property:


From URL:


Java

config.setUserStyleSheets(new Resource().setUri("https://server/layout.css"));

PHP

$config["userStyleSheets"] = array(array("uri" => "https://server/layout.css"));

C#

config.UserStyleSheets.Add(new Resource { Uri = "https://server/layout.css" });

JavaScript/Node.js

config.userStyleSheets = [{ uri: "https://server/layout.css" }];

Python

config["userStyleSheets"] = [{ "uri": "https://server/layout.css" }]

Ruby

config["userStyleSheets"] = [{ uri: "https://server/layout.css" }]

Perl

$config["userStyleSheets"] = [{ "uri" => "https://server/layout.css" }];

CLI

-c "https://server/layout.css"

REST

{ "userStyleSheets" = [{ "uri": "https://server/layout.css" }]}


From Content:


Java

config.setUserStyleSheets(new Resource().setContent("p { color: red }"));

PHP

$config["userStyleSheet"] = array(array("content" => "p { color: red }"));

C#

config.UserStyleSheets.Add(new Resource { Content = "p { color: red }" });

JavaScript/Node.js

config.userStyleSheets = [{ "content": "p { color: red }" }];

Python

config["userStyleSheets"] = [{ "content": "p { color: red }" }]

Ruby

config["userStyleSheets"] = [{ content: "p { color: red }" }]

Perl

$config["userStyleSheets"] = [{ "content" => "p { color: red }" }];

CLI

-c "p { color: red }"

REST

{ "userStyleSheets" = [{ "content": "p { color: red }" }]}


XSLT style sheets can be set either using a configuration property, or by referencing them in the document. They cannot be specified directly inline as CSS style sheets can be.



Note:

XSLT style sheets are applied in a preprocessing step, before the document is laid out and CSS or JavaScript is processed.


Adding an XSLT style sheet using a configuration property:


Java

config.setXsltStyleSheets(new Resource().setUri("style.xsl"));

PHP

$config["xsltStyleSheets"] = array(array("uri" => "style.xsl"));

C#

config.XsltStyleSheets.Add(new Resource { Content = "style.xsl" });

JavaScript/Node.js

config.xsltStyleSheets = [{ uri: "style.xsl" }];

Python

config["xsltStyleSheets"] = [{ "uri": "style.xsl" }]

Ruby

config["xsltStyleSheets"] = [{ uri: "style.xsl" }]

Perl

$config["xsltStyleSheets"] = [{ "uri" => "style.xsl" }];

CLI

--xsltStyleSheets "" "file:///C:/xsl-style.xsl"

REST

{ "xsltStyleSheets" = [{ "uri": "style.xsl" }]}


Referencing an external XSLT style sheet via the <link> element:


<link href="wizardOfOz.css" type="text/css" rel="stylesheet"/>