Stylesheets#

Inhaltsverzeichnis

ztemplates supports css. To keep code modular, you put the style for a particular view into a file called YourClassName.css beside YourClassName.java that must be annotated with @ZRenderer The name of the stylesheet must be Class.getSimpleName() + ".css".

At application startup ztemplates scans the classpath and aggregates all *.css found beside classes annotated with @ZRenderer to one stylesheet called ztemplates.css . The stylesheet can be accessed from the html with <LINK rel="stylesheet" href="/your-contextPath/ztemplates.css">.

To use the stylesheet set zscript to true @ZRenderer(..., zscript=true) and place ${zscript} in your template html head section. See AJAX for details.


@ZRenderer(..., zscript=true)

Advantages#

To make refactoring easier and avoid style-name collisions in css styles a default value 'cssId' has been added to default exposed values. This value can be used to name the styles.

You have to use ${cssId} not $cssId in the css-file.

in css:


.${cssId}-title {
   font-style: bold;
}

in template:


<div class="${cssId}-title">Bla bla bla</div>

Now you are sure your title style does not collide with another one form another template. See Css tutorial for more details.

Neuen Anhang hinzuf�gen

Du bist nicht autorisiert, Anh�nge zu dieser Seite hochzuladen.
« Diese Seite (Version-) wurde zuletzt am 29-Dez-2011 11:43 von gerdziegler.de ge�ndert.