Using shared CSS between forms and widgets

  • formmobly
    Asked on December 21, 2018 at 12:36 PM

    Hi!

    I guess you guys are hearing way too much from me in the past few days. Sorry about that!

    I am employing CSS heavily in my form and my company has been on my back to match the forms' style to that of our brand. However, each form and widget require individual CSS setting.

    In order to concentrate rules in a single place, I tried uploading my CSS files elsewhere and using @import from within the code, but to no avail.

    tl;dr: What if you stored our CSS rules in .css files and allowed us choose which set of rules to use in which widget or form? This way we wouldn't have to resort to copypasta of the same CSS rules over and over, saving some storage space and maybe redundant processing* of the same data in a form.

    *Since CSS rules are cached by the browser, a widget loaded countless times will only download the CSS rules once per session.

    Sorry for being such a bother!

    Dan.

  • Kevin Support Team Lead
    Replied on December 21, 2018 at 1:52 PM

    You can actually import style sheets using "@import", here is an example: 

    - I have the following import code on my form: 

    1545418216screenshot 02 Screenshot 10

    - This is the result: 

    1545418252screenshot 01 Screenshot 21

    Here's the style sheet I'm importing: https://shots.jotform.com/kevin/Content/Files/style.css 

    Make sure to be uploading your CSS style sheet to your own server and that there are not restrictions. 

    Thanks.