Personal tools
You are here: Home Documentation Tutorials Creating a new theme for Plone: a real-world example (Plone 2.1, 2.5) Portlet and navigation styles
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

Portlet and navigation styles

Adding proper styles to the portlets and the navigation tree in particular.

Alexander Limi

In this tutorial, Alexander Limi will show you how to take a default Plone site and put a totally different look on it. (Not updated for Plone 3.0)
Page 12 of 15.

One of the hardest things to get right is always the navigation. It is an inherently complex structure, especially since you might want different stylings on the different levels — for example different colors on the second-level navigation and third-level navigation. Luckily, Plone gives you a lot of CSS classes to latch on to, and my best advice when creating your own schemes is to use the DOM Inspector religiously to find which classes to manipulate.

We chose to go for a simpler style for demonstration purposes.

First, some basic portlet/breadcrumb styling — add the following to your CSS:

    /* Navigation */
    #portal-breadcrumbs {
        margin: 1em 1em 1em 19em;
    }

    #portal-breadcrumbs {
        display: none;
    }

    .portlet dt {
        background-color: #d3cebc;
        margin-bottom: 0.5em;
        display: block;
        padding: 0.2em 0.5em;
    }

    .portlet dd {
        margin-left: 0;
    }

    .portlet a {
        text-decoration: none;
    }

    .portletItem {
        padding: 0.5em;
    }

    .portletFooter {
        border-bottom: 1px dashed #c9c4c0;
        padding: 0.5em;
        text-align: right;
    }

    .portletItemDetails {
        text-align: right;
        display: block;
        color: black;
    }

Then we add the navigation-specific elements:

    .portletNavigationTree {
        padding-left: 0;
    }

    #portlet-navigation-tree .portletHeader {
        display: none;
    }

    .portletNavigationTree a {
        background-color: #d3cebc;
        margin-bottom: 0.5em;
        display: block;
        padding: 0.2em 0.5em;
    }

    .navTreeItem {
        display: inline;
        list-style: none;
        list-style-image: none;
    }

    .navTreeItem a,
    .navTreeItem a:visited {
        text-decoration: none;
        color: #463229;
    }

    .portletNavigationTree a:hover,
    .navTreeCurrentItem {
        color: #d3cebc !important;
        background-color: #463229 !important;
    }

Whew, this looks a bit complex if you haven't seen CSS before, but if you add the rules one at a time, you can see the progression, and what each rules does. If you reload, you should now have the following:

Wow, now we're talking. It's starting to look like the proper design now, just needs some tightening of the margins and positioning.

 
by Alexander Limi last modified April 5, 2006 - 07:23
Contributors: David Convent, Reinout Van Rees
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