ANS-0232 · SUITESCRIPT DEVELOPMENT

How to Apply Multiple CSS Classes to an HTML Element in NetSuite Customizations

Developers can enhance the styling of custom HTML elements within NetSuite by assigning multiple CSS classes, enabling combined visual effects.

Short answer

To apply multiple CSS classes to an HTML element, list each class name separated by a single space within the class attribute. This method allows an element to inherit styles from all specified classes, combining their properties for a richer visual presentation. This technique is fundamental for flexible styling in NetSuite customizations.

Scenario

When customizing NetSuite interfaces with HTML, developers often need to apply diverse styling rules to a single element. The challenge arises in efficiently combining multiple distinct CSS styles without creating redundant or overly complex class definitions.

Solution

The fundamental principle for applying multiple CSS classes to an HTML element is to list each class name within the class attribute, separated by a single space. This method allows an element to inherit styles from all specified classes.For instance, consider the following CSS class definitions:

css.white{ color:white; }
css.toolbox{ display:inline; }

To apply both of these styles to an HTML div element, the class attribute would be structured as follows:

html<div class="white toolbox"></div>

In this example, both the .white and .toolbox styles will be applied to the div element, combining their visual properties.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant