ALI Portlet Development

Portlet Style

The new CSS template provided with version 6.0 allows you to customize portlet content and design in a variety of ways. You can customize specific portlets using the unique ID assigned to each portlet, or use CSS classes to modify the design of a group of portlets (e.g., those in the first column of a two-column page). You can also set constraints for portlets, including limiting a specific portlet to a three-column layout or preventing users from collapsing portlets.

This page provides basic syntax rules and customization examples.

Syntax

The portal CSS template file follows standard CSS syntax rules. For details on CSS, see http://www.w3.org/Style/CSS/. Below are some basic rules to keep in mind when modifying portlet styles.

To apply a CSS tag to a specific portlet, use the portlet ID. the example below increases the size of the portlet title for the portlet with ID 6. (You can also define basic styles for a specific portlet within the portlet code.)

#pt-portlet-6 .portletTitle
{

height: 26px;

}

You can also apply styles to groups of portlets, including those on a specific page or in a specific community. To apply styles to a portlet on a specific page or community, use the page or community ID. The example below removes the portlet preferences link for portlets on the page with ID 100.

.portletPrefsButton #pt-page-100
{
display: none;
}

Style Customizations

The portal CSS template file allows you to make a wide range of style changes to portlets. The image below is the default style for a portlet.

 

Following are examples of portlet style customizations using the portal CSS template file.

#pt-portlet-100 { background-color: white; }
#pt-portlet-100 .platPortletHeaderBg { background-color: tan; }

You can also define basic styles for portlets within the portlet code (instead of in the CSS template file). Use the pt:token transformer tag to reference the portlet ID and ensure that the style is only applied to the current portlet. This code sets the portlet background to tan.  

<pt:namespace pt:token="$$TOKEN$$" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>
<style>
#pt-portlet-$$TOKEN$$ { background-color: tan; }
</style>

#pt-portlet-43 .portletBody
{
padding-bottom: 5px;
}

Constraints

The portal CSS template file allows you to set constraints for portlets. Below are some examples.

#pt-page-1 #pt-portlet-15
{
width: 250px;
}

.ptPageUser-guest .portletCollapseButton
{
display: none;
}

Note: Using CSS to hide functionality is not a secure means of preventing user-server interaction. All examples are for demonstration purposes only and are not meant to imply a complete solution to any overall security scheme.