style

From Documentation
Revision as of 13:28, 19 January 2022 by Hawk (talk | contribs) (correct highlight (via JWB))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Syntax:

<?style [type="text/css"] [src="uri"] [charset="encoding"]
 [content="css snippet"] [if="..."] [unless="..."]?> 

Since 5.0.8

It specifies an element that shall be generated inside the HEAD element. It is generated after ZK default JavaScript and CSS files. Thus, it could override what is defined in ZK default CSS code. Currently only HTML-based clients (so-called browsers) support it. Furthermore, HTML STYLE or LINK tags are actually generated for each of this declaration.

Developers can specify whatever attributes you like; it is up to the browser to interpret. ZK only evaluates the if and unless attributes, and encodes the URI of the href and src attribute (by use of Execution.encodeURL(String)). ZK generates all other attributes directly to the client.

Notice that these header directives are effective only for the main ZUL page. In other words, they are ignored if a page is included by another pages or servlets. Also, they are ignored if the page is a zhtml file.

1 <?style src="/css/foo.css"?>
2 <?style content="
3   div.blue {background: blue}
4 "?>
5 
6  <div sclass="blue">
7      My content
8  </div>

As shown above, the attribute value could span multiple lines.

Alternatives

Alternatively, you could use the style component to embed CSS code. Using the style component if you'd like to add or remove the style dynamically (since it is a component), or the page will be included by others.

Version History

Version Date Content
5.0.8 July, 2011 The style directive was introduced.



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.