Thanks for the solution above. It's ridiculous that extra code is needed for a basic function. At a minimum, HubSpot should have a responsive button to toggle to add this. It's 2021.
Just wanted to say THANK YOU because this is the only thing I found that works for a non raw-HTML version of the HS form embed. One note though for any future folks trying to figure this out -- the above code needs to go after the HS embed script, like so:
@ajj, how did you add this form to your site? the iframe has a width of 300 applied to it. the code looks different than i am used to. did you paste the form script in?
you have an event firing on form load that is setting the width of the iframe, but it does not fire on window resize. you will want to modify this script to call the function on window resize
Hi, I had this issue on the pages for HS account, which has only the basic formating of forms. The forms are loading inside the iframe there, so you can't apply CSS directly, but you can overide the iframe inline css by "!important" like: