Personal tools
You are here: Home Documentation Tutorials Rounded Corners on Portlets using only CSS Ensuring that the portlets' width remains constant
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Ensuring that the portlets' width remains constant

For this method to work we need to ensure that the portlets' width does not change as the user manipulates the page. Here's how.

Paulo Lopes

Put the "Rounded Corners" look on your portlets using only custom CSS and three images.
Page 2 of 4.

The standard Plone skin is not very good at ensuring that portlet width is always the same because it uses the HTML <table> element to devide the page in the 3 columns that have the portlets on the left, the main content, and the portlets on the right

That's why we are going to switch to the "Tableless" Plone skin that comes standard with every Plone release, because it's more CSS based.

So, let's assume that you are logged in as a user with administrative priviledges.

First you must click on "Preferences" and then on Plone's control panel's "Skins" item.

On this page you can change the defSelect Tableless Skinault skin to "Plone Tableless".

As you apply this change it is possible that your browser becomes momentarily confused. For example, the side columns may disappear. If that happens you should click on the page refresh button of your browser while holding down the Shift key, so that the browser's cache is flushed.

Using this "Tableless" skin does help ensure that the portlet's width remains constant but it alone is not enough. We don't want the width to change even if the user changes the page font size on his or her web browser.

To deal with that possibility we must go to Zope Management Interface (ZMI)--the engine behind Plone. That's where we change things that can't be configured yet using Plone's Control Panel, and it is where we will do must of our work during this tutorial.

Access to the ZMI is available on Plone's Control Panel.SelectZMI.png

On ZMI's main management page you see a list of the many components that make up Plone, some of which are folders with sub-components.Select portal_skins

We want to customize the current skin. The component folder that we must select is the "portal_skins".

As we do so we enter another list of components that have to do with what Plone looks like.Select plone_styles

We are going to work with CSS. The CSS files are under the "plone_styles" sub-folder, and so is the "base_preferences" file where we are going to specify the exact width for our portlets.

Customize buttonAt this time you must click on the "base_preferences" file.  It shows you a list of preferences. In order to be able to change these preferences you must click on the "Customize" button up at the top of the page.

ChangePortletWidthInBaseProperties.png

This file has now been automaticaly moved to the "/portal_skins/custom" folder in the ZMI.

We can now modify it. As you scroll down to the bottom of the customized "base_preferences" page you'll find the "columnOneWidth" and "columnTwoWidth" fields.

You must change both to 176px, and then click on "Save Changes".

There is one more thing to change: It is the padding that exists beside each portal column. But default it is configured to change if the font size happens to be changed by the user. That would affect the portlet's width as well--if the padding becomes wider because the user enlarges the browser's font size then the portlets become narrower.

To make this padding constant we must make the first customization to the CSS rules by hand:

To do that you must go back to the "/portal_skins/plone_styles" directory in ZMI and customize the "ploneCustom.css" file. This file is meant precisely for such customizations. So let's click on it.

You see a text file that is all greyed out.

In order to be able to change it we need to press the "Customize" button as we had done before for the "base_properties" file. This will automatically place a copy of it in the "/portal_skins/custom" folder as well, where we can edit it manually.

This file is made up of comments, two of them have special meaning to Plone so we won't touch those two comments. There is another comment line that says /* DELETE THIS LINE AND PUT YOUR CUSTOM STUFF HERE */. It marks the place in the file where we are supposed to put our customized CSS rules.

So, at this point you are going to remove that comment line and you are going to type in its place the following CSS rules that will make the padding beside the portlets become constant:

body #portal-column-one .visualPadding {
  padding-left: 22px;
}

body #portal-column-two .visualPadding {
  padding-right: 22px;
}

After you type this in (replacing the comment line mentioned above) you can now click on the "Save Changes" button.

There should be no visual difference in Plone, but we have ensured that the portlets' width remains constant at... let's make some calculations... 176 pixels column width... minus 22 pixels side padding... which results in a portlet fixed width of 154 pixels.

If you'd rather use a different width for your pottlets make your decisions at this point and put the appropriate values in the "base_properties" and "ploneCustom.css" files as described above, so that the resulting portlet width is the one you want.

Now it's time to round-off some corners.

 
by Paulo Lopes last modified January 31, 2006 - 15:26 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by