How CSS Styling Works
The Gantt chart renders inside an iframe embedded in your Polarion wiki page. CSS styles defined in a Script block widget on the same page are automatically copied into the Gantt iframe, allowing you to override default styling for task bars, text, grid columns, and other visual elements.Step 1: Add a Script Block Widget
- Open your Gantt wiki page in edit mode
- Add a Script - block widget to the page (from the Widgets panel)
- Place it anywhere on the page (it does not need to be adjacent to the Gantt widget)
Step 2: Add CSS Styles
Insert your CSS inside a<style> tag within the script block. Common customizations are listed below.
Change Right-Side Text Appearance
Adjust the color, size, and position of text displayed to the right of task bars:- Positioning: Modify
topandbottomvalues to adjust vertical alignment - Appearance: Customize
colorandfont-sizeto match your style
Change Font Color of Task Labels
Style Completed Items with Strikethrough
Use an item script to add a CSS class to completed items, then target that class:Step 3: Adjust Row and Task Heights
Row and task heights are controlled via the Gantt Config Script (not CSS). Navigate to the widget parameters, open Advanced > Gantt Config Script, and add:| Property | Description | Recommendation |
|---|---|---|
task_height | Height of the task bar in pixels | Set slightly smaller than row_height |
row_height | Height of each row in the grid and chart | Minimum 2px more than task_height |
Common CSS Targets
| CSS Selector | Element | Use Case |
|---|---|---|
.gantt_task_line | Task bar container | Background color, borders |
.gantt_task_content | Text inside task bar | Font size, color, alignment |
.gantt_side_content | Text beside task bar | Right-side labels |
.gantt_tree_content | Grid cell text | Grid column font styling |
.gantt_task_progress | Progress fill inside bar | Progress bar color |
Verification
You should now see:- The Gantt chart renders with your custom styles applied
- Text colors, font sizes, and positioning match your CSS definitions
- Row and task heights reflect your Gantt Config Script settings
See Also
- Configure Item Colors
- Configure Right-Side Text on Task Bars
- Adjust Gantt Row Height
- Write Item Scripts
- Write Gantt Config Scripts
Sources
Sources
KB Articles
- Adjust the right-side text properties
- Customizing Progress-Related Coloring in the Gantt Chart
- How to create a dependency link in Gantt?
prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/components/components.jsprod-gantt-src/com.nextedy.polarion.gantt.client/src/js/generic/polarion.jsprod-gantt-src/com.nextedy.polarion.gantt.client/src/js/generic/constants.jsprod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/GanttFilterByResourceMarker.cy.tsprod-gantt-src/com.nextedy.polarion.gantt.client/src/js/config.js