Monday, July 6, 2009

Tapestry5 - How to override elements of standard stylesheet

Create a file styles.css (or any other name of your choice) in your main/webapp directory (where you have all your .tml files)

Enter the styles in this file, for example - to override the color of chenillekit sliding panel, you can make an entry in this file:

DIV.ck_slidingPanelSubject {
background: #CCFF99;
}


Now, in yourpage.java - enter the following property to pull in the sylesheet:

import org.apache.tapestry5.Asset;

@Inject
@Path("context:styles.css")
@Property
private Asset styles;


And in yourpage.tml, pull the stylesheet in your header tag, as follows:

<head>
<link rel="stylesheet" href="${styles}" type="text/css"/>
</head>

No comments:

Post a Comment