DFFS: Styling

Examples of CSS for DFFS forms. Put CSS that applies to the whole form in the Custom CSS tab, and CSS for single fields in the Field CSS tab. Use the browser’s developer tools (F12) to find an element’s classes and id. Ask for more examples in the forum.

Classes and ids DFFS sets

SelectorElement
#dffs_FieldInternalNamea field’s row (label and value cells)
td.ms-formlabel, td.ms-formbodylabel cell, value cell
table.ms-formtable.dffs_newform / .dffs_editform / .dffs_dispformthe form table, by form type
body.dffs-mobile-mode, body.dffs-desktop-modethe mobile or desktop layout (Mobile)
#tabWrapper, li.tabBase, .tabSelected, .tabHidden, .tabFormValidationthe tab row, a tab, the selected tab, a hidden tab, a tab with an empty required field
.tabH1, .tabH2, .accordionHeadingbuilt-in heading styles; .dffs-accordion-activePanel is an open expand/collapse heading
.dffs-readonly, .dffs-readonly-innera read-only field’s row, and the text shown instead of the input
.dffs-formvalidationthe “required field” message under a field
.dffsValidationa message from Display this message
.customTooltip, .customTooltipIcona field tooltip and its icon
.dffs_label_tailthe last word of a label, kept on one line with the required star and the tooltip icon
.sbs_OuterTable, .sbs_FieldTable, .sbs_FieldLabel, .sbs_tdIndex_1 …side-by-side: the group, its table, a field label, the 1st, 2nd … column from the left
#sbs_OuterTable_1 …, #sbs_Field_FieldInternalNameside-by-side: one group by its side-by-side index, one field’s column
.dffs_dlg_box, .spjs-dlg-btnDFFS dialogs and their buttons
.dffs_noPrint, .dffs_noEmailadd these to your own HTML to leave it out of printouts or e-mails

Colours

The selected tab, dialog headers, OK buttons, loading spinners, vLookup group headers and checked checkboxes, radio buttons and Yes/No toggles use the DFFS blue. The colours are CSS variables, so you can change them for the whole form in Custom CSS. Internet Explorer 11 and Edge IE mode do not support CSS variables and keep the built-in colours; style the elements themselves for those browsers.

VariableDefaultUsed for
--dffs-accent#2a5fd0the accent colour: selected tab, buttons, checked boxes
--dffs-accent-hover#2350b3buttons on hover
--dffs-accent-50, --dffs-accent-100#eef3fb, #dce6f7light accent backgrounds
--dffs-accent-muted#85a3e2checked boxes in read-only fields
--dffs-text, --dffs-text-muted#1f2937, #5f6b7atext and secondary text
--dffs-border, --dffs-divider#d6dde7, #e5e9f0borders and dividing lines
:root {
    --dffs-accent: #107c41;
    --dffs-accent-hover: #0b5c30;
}

Your own CSS for an element wins over these colours, as before.

Side-by-side: the width of a field

A side-by-side group fills the width of the form, at least 785 px, and its fields share that width evenly. Text inputs, dropdowns, multiple-lines fields, people pickers and read-only fields fill their column; date and time pickers and multi-select lookups keep their size. A hidden field gives its space to the others, and a label on the left or right takes only the room it needs.

To give one field its own width, use its id in Custom CSS, in px or %. The other fields in that group share what is left:

#sbs_Field_Title {
    width: 50%;
}

DFFS finds these rules in Custom CSS and in stylesheets on the same domain as the form; it cannot read a stylesheet from another domain. You no longer need to reset the widths with .sbs_FieldTable * { width: auto !important; } first; that rule now shrinks the inputs back to their small default size.

Side-by-side: fixed column widths

To set widths by position instead of by field: each side-by-side column has a class with its position from the left, starting at 1. This sets the first four columns to 200 px; write separate rules to give each column its own width.

Side-by-side columns with fixed widths
.sbs_tdIndex_1, .sbs_tdIndex_2, .sbs_tdIndex_3, .sbs_tdIndex_4 {
    min-width: 200px !important;
    width: 200px !important;
    white-space: normal !important;
}

Side-by-side: width of the group

A group is at least 785 px wide. To make it narrower, set min-width too. Use #sbs_OuterTable_1 (the side-by-side index) for one group only:

.sbs_OuterTable {
    width: 500px;
    min-width: 0;
}

Line up labels with side-by-side groups

td.ms-formlabel {
    width: 130px !important;
    white-space: normal !important;
}

Larger side-by-side labels without the gap below

.sbs_FieldLabel {
    height: auto;
}
.sbs_FieldLabel .ms-formlabel {
    font-size: 1.2em;
    font-weight: 500;
    padding: 2px 2px 0 2px;
}

Scrollbar on a long multiple-lines field

Replace YOURFIELDINTERNALNAME with the field’s internal name:

#dffs_YOURFIELDINTERNALNAME textarea {
    max-height: 200px;
    max-width: 600px;
    overflow-y: auto;
}

Field CSS tab: one field

In the Field CSS tab, the CSS you enter for a field applies to its row. For example the width of a single line of text field:

input {
    width: 150px;
}

Background colour in all multiple-lines fields

textarea {
    background-color: #ffcccc;
}

Background colour while typing

input:focus {
    background-color: #ffcccc;
}

Tooltip icon before the label

The tooltip icon follows the label text (with the required star). This moves it to the left edge of the label cell, also in side-by-side fields. Every label gets the same left padding, so labels without a tooltip still line up:

td.ms-formlabel {
    position: relative;
    padding-left: 28px;
}
td.ms-formlabel .customTooltip {
    position: absolute;
    left: 4px;
    top: 4px;
    padding: 0;
}

Multiple choice values on separate lines in DispForm

This one is JavaScript, for the Custom JS tab of DispForm:

function showChoicesOnSeparateLines(fin) {
    // In DispForm the value is the displayed text, with the choices separated by "; "
    var html = String(getFieldValue(fin)).split("; ").join("<br>");
    jQspjs("#dffs_" + fin + " td.ms-formbody").html(html);
}
function dffs_Ready() {
    showChoicesOnSeparateLines("YourFieldInternalName");
}

Desktop or mobile only

With mobile support on, prefix selectors to style one layout:

.dffs-desktop-mode td.ms-formlabel { width: 180px; }
.dffs-mobile-mode .ms-formbody input { font-size: 16px; }