Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be very helpful if Webform had the ability (either out of the box or as an add-on) to change the submit button color. This capability is critical to improve click through rates and creating custom CSS and classes is so onerous. Thanks!
Comments
Comment #2
Liam MorlandThe proper place to do styling is in the theme. Webform doesn't control submit button appearance. There are enough CSS classes that the submit button can easily be selected in CSS.
Comment #3
NetBrowser CreditAttribution: NetBrowser commentedFor me it has been a big struggle to change style css for Submit Button, even if you say so, it is not that easy as in my experience i've been trying to modify easily the CSS Style color attribute and I am able with easy selectors to change it for other elements but for WebForm the only way that I was able to change is using a selector like this:
.btn a, .more-link a, input[type="submit"], input[type="reset"], ul.links li a, .view-portfolio .views-field-view-node a, #block-poll-recent ul.links li a, #filters li a, .content ul.pager li a, .content ul.pager li.pager-current, .view .date-nav-wrapper .date-prev a, .view .date-nav-wrapper .date-next a, .form-submit {color: #ffffff;}
Maybe you can point us in a good direction to do something better.
PS: I am not a CSS expert but for the basics I am ok.
Comment #4
Liam MorlandYour example combines a bunch of selectors for a while bunch of different things. The one that is actually active is probably:
input[type="submit"]
I suggest you use this:
input.webform-submit
Comment #5
NetBrowser CreditAttribution: NetBrowser commentedMy solution after several attemps and testing class by class modify or remove any style as required:
I have found a module that adds classes to any webform button but I was not able to use the custom class:
https://www.drupal.org/project/webform_button_classes
Thank you Liam seems to be it was exactly your solution, my mistake is that I was adding
input[type="submit"] a
andinput[type="submit"] a:hover
and as I understand the "a" or "a:hover" were not necessaryComment #6
Liam MorlandYou may need to learn more about how CSS selectors work.
input[type="submit"] a
would select ana
element inside aninput
element that has atype
attribute with valuesubmit
. That doesn't make sense. A comma in a selector separates multiple selectors. The rule will apply to all of them.