Legacy Knowledge Base
Published Jul. 2, 2025

Overriding Liferay's Default CSS for Individual Portlets

Written By

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

In custom environments, it may be necessary to apply custom styles to specific portlets. The example below gives guidance on how to override the Liferay Theme CSS in order to customize portlets to fit requirements.

Resolution

Affected Products

Liferay Portal 6.0 EE SP2 and above

Please use the example below as a reference for editing CSS for input text box color and button hover color.

1. After adding a portlet, navigate to Look and Feel > Advanced Styling.
2. Click the link "Add a CSS rule for just this portlet," and it will create the following:
 
#portlet_id {
}
 
3. For the text field input on focus, Liferay uses the following in main.css
input.focus,textarea.focus,.ie6 input.focus,.ie6 textarea.focus
 
4. For the button hover
input[type="submit"]:hover, input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:focus, input[type="button"]:focus, input[type="reset"]:focus, button:hover, button:focus
 
Once you declare the scope as such #portlet_id elements { styles }, then you can start declaring the styles themselves.
Did this article resolve your issue ?

Legacy Knowledge Base