Portal CSS Overrides

Within a custom portal, you can use CSS to adjust the display of portal elements. In some cases, adjustments may be necessary to edit the display of standard widgets to accommodate the specifics of an institution's branding.

  Best Practice

For CSS changes that should be reflected only in a portal, use the Portal CSS Editor, rather than editing the shared/build.xslt file or build.css files directly. For changes specific to a form, use the Form CSS Editor.

  Tip

If a portal uses tabs, adjustments to the CSS can also be added to the Portal CSS Editor, like in these examples.

Styling View Widgets

All portal widgets within a view will have a class of "part", which can be referenced in a CSS rule to affect the display of all widgets. However, you may also add a class or classes to specific portal widgets in order to control their display. When editing a portal widget, the CSS Class Name field allows adding one or more class names, separated by spaces! You can then reference those class names in your portal CSS rules.

For example, to add spacing below a particular widget, you could add a class of "space-below", and then add a CSS rule (using the portal CSS editor) of

div.part.space-below { margin-bottom: 30px; }

Users can add CSS rules not just for spacing, but for any other number of styles. For instance, adding a custom CSS rule for bright_border will add a border around any widget with that CSS class.

div.part.bright_border { border: 2px solid #251d6f; padding: 5px; }

Adding CSS rule to Portal

Adding CSS class to Widget

Widget in Portal Displays with Border

The ability to add multiple classes to a given widget allows you to, for example, style each widget separately, but then also add the same class to a group of widgets to be able to style them all with a single rule. For example, you could add classes of "even" or  "odd" each widget to enable styling alternating widgets differently.

CSS Overrides for Checklist Widgets
Changing Column Widths

In some cases, columns on checklist widgets will need to be made wider or more narrow, depending on the default font size or the font family that is specified to be used by the global branding template.

Admissions Checklist

div#part_admissions table.table col:nth-child(4) {width: 300px !important;}

In the above code, you can set a specific width of a column. The checklist table above consists of four columns: the checklist icon, the checklist status, the checklist details, and the checklist date. The "nth-child" CSS selector in the above example uses "4", as "Date" is the 4th column of this table. Should other columns need adjustment, the "nth-child" selector can be updated accordingly. The table in question has a class of "table" and is nested inside, in this example, a div element with the id "part_admissions".

This kind of snippet can also be updated to target different parts of your portal view code. If one is using the 'Checklist By Section' widget, it could be helpful to set the same date column for all the checklist tables (section tabs) in one instruction. 

div[id^='part_checklist_'] table.table col:nth-child(4) {width: 15% !important;}

In general, the [attribute^=value] CSS selector matches every element whose attribute value begins with a specified value. In this example, we are targeting the 4th column of a table element with class of 'table' that is nested within any div element whose id attribute starts with the string "part_checklist_". This would set the width for that column for all the section tabs that are configured in that portal widget.

Depending on the desired adjustments, the width can be set to either a specific pixel width or percentage. The !important property indicates that subsequent rules on the element should be ignored.

Dot/Ellipsis after Checklist Icon

In some cases you may see a dot next to checklist icons ( ,  ). The dot is actually the beginning of an ellipsis which is displayed when there is too much text or content for a given element and the overflow setting on that element is configured in a particular way.

Checklist icons

Institutions can either (a) increase the width of the first column using the technique described above or (b) unset the text overflow property of the table cells. Example for an Admissions Checklist table below:

#part_admissions table.table col:nth-child(1) {width: 28px !important;}
#part_admissions table.table>*>tr>td {text-overflow: unset !important;}
Text Wrapping within a Column

In some cases it may not be practical to adjust the table width. If checklist detail descriptions contain long strings, it might be better to allow the text to wrap onto 2 lines rather than adhering to a neat table row display:

Checklist Overflow Subject

#part_admissions table.table>*>tr>td {white-space: normal !important;}

Checklist Two Line Subject

  Tip

To find the table or div IDs, use a web browser's developer tools to "Inspect Element."

Was this article helpful?
2 out of 2 found this helpful