Styling
You can style Microform Integration to look and behave like any other input field on your site.
General Appearance
The <iframe> element rendered by Microform has an entirely transparent background that completely fills the container you specify. By styling your container to look like your input fields, your customer cannot detect any visual difference. You control the appearance using your own stylesheets. With stylesheets, there are no restrictions and you can often re-use existing rules.
Explicitly Setting Container Height
Typically, input elements calculate their height from font size and line height (and a few other properties), but Microform Integration requires explicit configuration of height. Make sure you style the height of your containers in your stylesheets.
Managed Classes
In addition to your own container styles, Microform Integration automatically applies some classes to the container in response to internal state changes. This table describes the managed classes:
| Class | Description |
|---|---|
.flex-microform | Base class added to any element in which a field has been loaded. |
.flex-microform-autocomplete | The field has been filled using an autocomplete/autofill event. |
.flex-microform-disabled | The field has been disabled. |
.flex-microform-focused | The field has user focus. |
.flex-microform-incomplete | The field is incomplete and could be valid. |
.flex-microform-invalid | The input card number is invalid. |
.flex-microform-valid | The input card number is valid. |
To use these classes, include overrides in your application’s stylesheets. You can combine these styles using regular CSS rules. Here is an example of applying CSS transitions in response to input state changes:
.flex-microform { height: 20px; background: #ffffff; -webkit-transition: background 200ms; transition: background 200ms;}/* different styling for a specific container */#securityCode-container.flex-microform { background: purple;}.flex-microform-focused { background: lightyellow;}.flex-microform-valid { background: green;}.flex-microform-valid.flex-microform-focused { background: lightgreen;}.flex-microform-autocomplete { background: #faffbd;}Input Field Text
To style the text within the iframe element, use the JavaScript library. The styles property in the set-up options accepts a CSS-like object that allows customization of the text. Only a subset of the CSS properties is supported.
const customStyles = { 'input': { 'font-size': '16px', 'color': '#3A3A3A' }, '::placeholder': { 'color': 'blue' }, ':focus': { 'color': 'blue' }, ':hover': { 'font-style': 'italic' }, ':disabled': { 'cursor': 'not-allowed', }, 'valid': { 'color': 'green' }, 'invalid': { 'color': 'red' }};const flex = new Flex('..........');// apply styles to all fieldsconst microform = flex.microform({ styles: customStyles });const securityCode = microform.createField('securityCode');// override the text color for the card number fieldconst number = microform.createField('number', { styles: { input: { color: '#000' }}});Supported Properties
These CSS properties are supported in the styles: { ... } configuration hash. Unsupported properties are not added to the inner field, and a warning is output to the console:
colorcursorfontfont-familyfont-kerningfont-sizefont-size-adjustfont-stretchfont-stylefont-variantfont-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-weightline-heightopacitytext-shadowtext-renderingtransition-moz-osx-font-smoothing-moz-tap-highlight-color-moz-transition-o-transition-webkit-font-smoothing-webkit-tap-highlight-color-webkit-transition
Thanks for your feedback!
Last published: September 29, 2026