0
votes

I'm very new in Drupal 8 development, I have created a basic webform using webform module and now i want to add custom css to make it more attractive so how can i add custom css in my webform? Any lead will be appreciated.. Happy Coding..

1
Can you show us your code? - Aviv Lo
Hi Aviv Lo, I have added this code in my theme folder inside css file #webform-submission-sample-multi-step-webform-add-form{ background-color: lightblue; font-style: oblique; font-size: 17px; font-variant: petite-caps; font-weight: bold; padding: 10px; } This code is sample code somewhat looks like with my original code. I think it will help you. i have one more question do you know about webform handler..? like how to setup custom webform handler in webform - Prajjwal Kumar

1 Answers

0
votes

If you just need to apply CSS styling, then if you view the source of the webforms you will see they have container divs with classes that contain an ID number. This ID will allow you to directly target a specific webform.

If you mean you want to add your own divs etc. and template different webforms, then the best way to do this is by creating a specific template file for it.

In your theme folder you can add a template file such as: webform-form-[nid].tpl.php you can get the ID by viewing the source of your form, it displays in one of the forms parent divs.

As your base you can use the default template from the webforms module. Goto (or other location where you have installed the webforms module):

/sites/all/modules/webform/templates/webform-form.tpl.php

and copy the folder.