I recently released my first WordPress plugin, InfuCaptcha, which inserts the new Google “noCAPTCHA” reCAPTCHA into Infusionsoft web forms. Because of this, I’ve spent a bit of time with the new version of reCAPTCHA.
While I really like the new version, I didn’t like how it is not responsive, so it extended outside my container when viewed on mobile:
I wanted to resize it, but it seemed no matter what I tried to target with CSS or a combination of CSS and javascript, nothing seemed to change the look of the captcha. So rather than trying to change what was generated by Google’s externally-loaded javascript and css files, I decided to change what I felt I could change – the div you place on your site with the g-recaptcha class that loads up the reCAPTCHA.
By using the CSS transform property you can achieve changing the width by changing the entire scale of the reCAPTCHA.
By adding in just two inline styles, you can make the reCAPTCHA fit nicely on your mobile device:
Much nicer!
Here’s what your new markup should look like if you want to get the same effect:
<div class="g-recaptcha" data-theme="light" data-sitekey="XXXXXXXXXXXXX" style="transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>
(Updated June 17, 2015: Thank you to Quyen Ha for correctly adding we still need webkit fallback for Safari iOs/iPhone! I’ve updated the code above to reflect that.)
You can adjust the scale to whatever looks best for your particular layout. The transform-origin property is added because when you use the transform property, it doesn’t change the actual space taken up by the element. So, in order to have the reCAPTCHA align to the top left, I set it so the transformation would originate from the top left-hand corner (rather than from the center, which is the default). I used “0 0”, but “left top” would have had the same effect.
That’s just a basic way to show how you can quickly change the size of the reCAPTCHA with inline styling. For something nicer, I’d suggest assigning a new class and leaving it at full size for anything above mobile, then using a media query to change it to the smaller size. Even better would be to use a transition effect so it visually “shrinks down” when you go to mobile.
To scale the images popup, you can use this code, either by inserting it as a separate style embed (like below) or simply adding it to your CSS:
<style> #rc-imageselect {transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;} </style>
Update September 8, 2015: I wanted to give props to Jon who came up with a more elegant solution that encompasses everything. Rather than changing the embed code inline, you can alternately add ONLY the following as a separate style embed (like below) or add it to your CSS (note I’m adding in the webkit styling that Jon left out when he made his comment):
<style> @media screen and (max-height: 575px){ #rc-imageselect, .g-recaptcha {transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;} } </style>
Update July 23, 2021: Option from Frank that uses the max-width instead of height. Use whatever works best for you! :)
<style> @media only screen and (max-width: 500px) { .g-recaptcha { transform:scale(0.77); transform-origin:0 0; } } </style>
Update October 1, 2024: Javascript option from Oleg. Nice!
function resizeCaptcha() { var captchaElem = document.getElementsByClassName(“g-recaptcha”)[0] var captchaWidth = captchaElem.children[0].offsetWidth; var parentWidth = captchaElem.parentElement.offsetWidth; captchaElem.style.transform = “scale(” + (parentWidth / captchaWidth) + “)”; captchaElem.style.transformOrigin = “0 0”; }; grecaptcha.ready(resizeCaptcha); addEventListener(“resize”, (event) => {resizeCaptcha()});
If you found this useful, please let me know in the comments below.
Comments 304
Thanks :)
Thanks! This was a frustrating problem. Very clever solution!
Merci
Thank’s for tips but not really responsive, just fix size more small on mobile and not worked on Iphone 6, safari browser. :-/
See the updated solution that addresses the issue on Safari/iPhone 6
Thank you! Very clever
And it is still not responsive. You just assume a smaller fixed size. A responsive implementation would react on any screen resoluation dynamicly. Which means you cannot just scale it to 77%. This solution is a start but nothing recommanded or good at all.
works great on a 320px wide screen.
Thx
Thanks! did not know how to solve this problem.
Very clever solution!
Thanks!
Thank you !!!
It was a big issue in mobile. Now all is working fine.
Thanks again, it solved a big problem in my life
Beautiful! Thanks a lot!
Thanks so much, this really helped me!
Thank you so much for providing nice solution
A very simple and clever solution to a frustrating problem!
Thank you, Atul! :)
Thank you so much
Thx for this post! :)
Fantastic – thanks for that!!
This actually worked great to fit in, however now, it triggers the second step verification every single time. Anyone else having the same issue?
thanks for such an easy solution :)
very useful fix, thank you
on iPhone 6 or Safari iOS we still need prefix -webkit fallback.
I hope Apple will standardize W3C like Chrome, Firefox in future!
-webkit-transform:scale(0.77);
transform:scale(0.77);
-webkit-transform-origin:0 0;
transform-origin:0 0;
Thank you! You are absolutely correct, and I’ve added your code to the post (with attribution, of course). :)
…and I hope Google will detect browser on server-side to use SVG Icon for Retina Display.
Because of zoom scaling will make icons blurred! (reCaptcha Logo and animate Circle)
Review at my site: http://i.imgur.com/xqEi8QA.png
Regard.
Thank you dear!
YOU ARE THE BEST!!!!!!!
Thanks, handy hack, no one else seems to have figured it out from my search :) best wishes
Thanks for the nice comment! :)
Brilliant fix, thanks so much Geek Goddess, are you the only person on the planet to have figured this out?!!!
Haha! Thanks for the nice comment! It’s very odd to me that the recaptcha isn’t responsive. It certainly should be!
But this won’t solve the resizing problem of the pop-up window which appears when you actually have to prove you’re not a robot…
Yes, i also realized about that…
Hope someone could help also with this: pop-up window which appears when you actually have to prove you’re not a robot…
omg, thank you for this awesome trick! it was pissing me off so much ahaha, glad your post was one of the first hits when I finally googled it :D
:)
Gracias
Thanks so much Geek Goddess
Thanks!! I had to update the reCaptcha on a couple of my sites and this really helped to keep things “responsive”
Great post thank you so much. You just helped over 5,000 websites make this work flawlessly on their sidebar contact forms that look just like yours :). You rock!
Thanks, Matt! Appreciate the kind words. :)
is there a way to scale down the size of the image that pops up once you click im not a robot? thats my main concern
Thanks for putting this up, Like others I’ve gone in circles over this. I was ok when Google laid down the ‘responsive’ rule, but by keeping this so strict and not adjusting it they have created so much agony for those do that comply.
Your trick ended a 4 hour seige today alone. Big thanks!
Thank you so much for this. I’ve been struggling with this as well, as I’ve used the Google noCAPTCHA reCAPTCHA on many websites I’ve developed, and it’s been a frustration. You really helped me a LOT. Appreciate the post.
Thank you for the nice comment. :)
Brilliant! Thank you so much! :)
amazing dude
You just saved me a lot of hair pulling!
Were you able to resize the popup challenge container where you have to select pictures? I’ve been trying to target that container without any luck.
Nitrox, See the new solution I added for the photos popup. Please let me know if this works for you.
This solution did not work for me. reCaptcha dynamically inserts a DIV into the DOM when a user clicks on the checkbox which prompts photo selection popup. The #rc-imageselect container is within an iframe loaded inside the dynamically inserted DIV and I could not target it with just the css media query.
I ended up using a jQuery/JavaScript workaround. It works by detecting (via MutationObserver) when a DIV is inserted and targeting inserted DIV. Then if it’s a small screen (mobile devices), then scale the popup.
This is what I used:
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
for (var i = 0; i < mutation.addedNodes.length; i++) {
if (mutation.addedNodes[i].tagName == 'DIV') {
var thediv = mutation.addedNodes[i];
var sw = window.screen.width;
if(sw < 667) {
$(thediv).css({"transform" : "scale(1.9)", "transform-origin" : "0 0", "-webkit-transform" : "scale(1.9)", "-webkit-transform-origin" : "0 0"});
}
}
}
});
});
// pass in the target node, as well as the observer options
observer.observe(document.body, {
attributes: false,
childList: true,
characterData: false
});
This code was posted here: http://stackoverflow.com/questions/30598602/detect-iframe-dynamically-using-jquery
And I modified a bit. Hopefully this can be useful to someone else.
Thanks for this!
I would suggest stripping out the inline style, using the current class presented by google, and applying the style to both the form and the image prompt only on screens smaller than 575px height:
@media screen and (max-height: 575px){
#rc-imageselect, .g-recaptcha {transform:scale(0.77);transform-origin:0;transform:scale(0.77);transform-origin:0 0; }
}
(with appropriate autoprefixing as needed of course!)
J
Great info GG
Having one small problem with the #rc-imageselect
Can anyone give me a working example of using this in an external css file ??
It does not seem to have any effect so far…
Same here, That is not working for me either. Tried external and inline.
Use @media screen and (max-width: 575px) instead of @media screen and (max-height: 575px)
Exactly what I was looking for, thank you!
Thanks, been searching for a solution to this for ages. Works like a charm :)
Thank you !
Thank you, excellent tips. However, applying styles to “#rc-imageselect” is not affecting (scaling down). Since that ID inside the iframe will that take the styles we are trying to set?
Hey George,
Good point. Was mucking about with that part too. Now looking into solving that issue…
Edit: Okay.. did some looking around. Of course not possible unless you can control the iframe src that’s being called. Which is Google’s… so no solution there. If the user puts it’s device into landscape mode upon being challended, it will work out without the scaling. You can only scale the g-recaptcha div, as that’s not inside of the iframe that’s out of our control.
I just find it ironic that Google starts pushing for “mobile” compliancy to be included in it’s Site Rankings and then somehow forgets to bother making any of it’s future products adhere to it’s own mandate where we have to add hacks to fix their lack of competency.
Thanks, been searching for a solution to this for ages. Works like a charm :)
Muchas gracias, por su ayuda, me ha sido muy util! :)
Worked superb. Regards
Thank you nice sharing …
OK i know very little about where this stuff goes. Can I put all of this in the custom CSS section of wordpress in the theme options area? Everything else in there starts with a . and has a couple of these in there } { .
#rc-imageselect {transform:scale(0.77);transform-origin:0;-webkit-transform:scale(0.77);transform:scale(0.77);-webkit-transform-origin:0 0;transform-origin:0 0; 0}
I tried adding this before header and nothing happened.
holy crap!!!
@media screen and (max-height: 575px){
#rc-imageselect, .g-recaptcha {transform:scale(0.77);transform-origin:0;transform:scale(0.77);transform-origin:0 0; }
}
this did the trick.
Thank you G-Goddess and Jon your code was what worked for me. Thanks guys, I was pushing my fingers in my eyes.
i used this code for my client’s site https://www.petdirectory.org/. I used your code into my child theme css file but its not working. Can you tell me how it will work for wordpress site where im using contact form 7 plugin.
Thanks, this was helpful!
Thanks a lot. Very useful :D
Thanksssssssssssssssssssssssssssss :D
Is there a solution that uses vw?
Thank you!!!
I thought for sure this was going to be a headache but you really helped out.
Happy coding!
-Graham
Hi there – I got it working but it’s not centering in my form. Any recommendations?
http://apstraining.com/loss-of-control-in-flight-loc-i/
Bottom right of page. Thank you!
Dear Paul Ransbury,
I hope here is yours. Let’s resize it every responsive @media{…}
http://i.imgur.com/SszSqG0.png
there is a parameter in the code to make the box smaller ;)
data-size=”compact”
This is not working for me at all. I have used this in a css file and it absolutely does nothing. Any recommendations?
@jen Some of the class names have change slightly, so you will want to make sure that your css is targeting the correct elements.
I’ve noticed that the #rc-imageselect element is located in an iframe and thus out of reach of css styles on the home page. It might be possible to apply something via javascript, but it would need to be triggered after the iframe loaded. Any thoughts?
I tried adding the styles in-line to a div wrapper around the captcha’s div. It worked fine on desktop but displays nothing on iphone (it causes the captcha to disappear). The fix provided above doesn’t work anymore.
brackets : }}
Modify code:
/* reCAPTCHA */
@media screen and (max-height: 575px){
#rc-imageselect, .g-recaptcha {transform:scale(0.69);-webkit-transform:scale(0.69);transform-origin:0 0;-webkit-transform-origin:0 0;}
}
Hi,
I have gotten to make recaptcha is in middle of screen and responsive width a css code:
#rc-imageselect, .g-recaptcha {
display: inline; //the most important
}
#rc-imageselect{
max-width: 100%;
}
.g-recaptcha>div>div{
width: 100% !important;
height: 78px;
transform:scale(0.77); //the code to rescale the captcha obtained in this page
webkit-transform:scale(0.77);
text-align: center;
position: relative;
}
I hope that this solution will be correct for you
Hi, nice. this one better. make it center.
This is clever. I am sorted. Thank you.
Other solutions did not work. This one did. Many thanks :-)
In my case all is working fine without adding any css.
I think google is detects device automatically and set layout based on it.
If i checked in desktop browser by resize it(ctrl+Shift+M), then it is not working but in my mobile it is automatically fit to screen.
Thanks! Great solution.
Thank you! Easy solution :D
Does not work in safari iphone ios 9
It would be far better if Google got over itself and didn’t brand the button.
Any ideas for triggering the popup verification from the Submit button rather than the check box??
Exactly what I was looking for. Thank you.
Worked great, thanks so much!
Me ha sido de mucha ayuda, pero, que opinas de la propiedad data-size?
Perfect, thank you..!
Typical of Google that it lays down the law to the Internet community about how sites should be built, but then breaks its own rules by releasing something like this without making it responsive..!
Thanks a tonnn for this help…. was completely stuck becz of such a silly issue.. applauseeesss :)
Thank you for the support!!!
thank you , it’s great solutions
Hi. I used your fix to shrink the reCAPTCHA box on my website (www.jphcs.com) and it looks great on a monitor but when I look at it on my Android phone the tool is missing. Ideas? Thanks!
I added in what Josh had above to replace the line transform.. and it works now on mobile as well.
Thanks Man…it works
Great !!!
Thanks from Spain!
Hi
I have had the same issue as everyone and tried your solution, which worked. Thank you.
The issue is that it now creates when clicking on the page (with reCaptcha on), the site navigation list to flash up for less than a second before the page is loaded fully. If you remove the reCaptcha HTML Code Fragment from the page in Webplus X8 the issue goes way…
I am not a coder and use Webplus X8 to do my website, but have managed to add your code in, but this has then created the issue – any thoughts would be welcomed.
Thanks
Great elegant solution! For us poor souls who still have to support IE-8 this should be added to CSS: -ms-zoom: 77%;
you are the gal!! thanks a lot!! i was dealing with this for the last hour!
Really very nice code
Hi, would this be the same for Joomla 3? I’m not sure where to change the code in Joomla 3
Thank you, you helped a lot ;-)
Thank’s for tips but not really responsive, just fix size more small but show the horizontal scroll in mobile due to inner div width 304px.
Please resolve this issue.
Thanks a lot!
Your can review & copy my form at http://www.hr2b.com/call
Responsive 320px, 360px,
375px (iPhone 6),
414px (6+),
480px,
640px… and above.
I came up with a different solution involving js. Google actually provides a data-size attribute which can be set to normal (default) or compact. What I did was to change the attribute based on the window size, the widget is then displayed in a square shape that fix perfectly on small mobile screens. Please see the code below
jQuery(document).ready(function ($) {
if ($(document).width() < 480) {
$('.g-recaptcha').attr('data-size', 'compact');
}
else {
$('.g-recaptcha').attr('data-size', 'normal');
}
});
I personally don’t like the compact version, and I believe it has been mentioned previously in this thread – but your thought is definitely a viable option for people. Thanks for contributing!
The author is genius!!!! This is so cool!!!
This code should be mentioned in the google recaptcha. Amazing work :)
Thank you, very nice
Very Nice solution to such a crack problem…!
Thanks so much!
Thank you very much !!
This is exactly what I’m looking for, but where do I put this code?
Thanks
Thank you my friend. I think google should do something about this but you were faster than that :)
Got a beautiful site. Best lucks…
God, THANK YOU! Was driving me NUTS.
A million thanks!
Thank You So much its work fine for me, solved my problem.
Thank you so much
Works Like A Charm Thanks :)
Thanks a lot!!!
Thanks
How to change background color for recaptch?
I need recaptcha so that I can sign up to enable downloads
Thank you for this very useful solution! You helped me a lot!
Hi, I using the Genesis theme and if I add the code into my custom CSS it does not work for me yet. Do I need to place the code to any other place? Thanks for feedback.
I wrestled with this for “a while” and came up empty. Thanks for the solution!
Hi, the scale for me doesn’t worked, but I hava resolved forcing the iframe to be position absolute.
.recaptcha {
@media only screen and (max-width: $break-maxwidth-medium) {
display: inline-block;
}
.g-recaptcha {
@media only screen and (max-width: $break-maxwidth-small) {
& > div > div {
width: auto !important;
}
iframe {
position: absolute;
top: 0;
left: 0;
transform: translateX(-50%);
}
}
}
}
Très intéressant. Merci beaucoup
Hey – any idea how to scale the captcha popup that comes up as well (i.e. the one that asks you to say pick the pictures with palm trees in them). I was able to scale the button itself but when a user needs to be verified, the dialog that shows up is way bigger than the screen.
Thank you!
Thank you for this nice example, but how to make it responsive?
DOESNT WORK FOR RESPONSIVE LAYOUTS. GEEK GODDESS YOURS SORT OF DOES FOR THE RECAPTCHA BUT THE UPDATE DOESNT WORK AT ALL. THANKS THOUGH ITS GOOD ENOUGH 4 ME ATM.
i would like to say great thanks for your share
Author
Thank you
Thank you
Hey thanks so much! this is great!
I changed max-width to 479px – i am using recaptcha in Caldera form on my site.
Btw, your code up top is missing a } bracket (update September 8, 2015:).
@media screen and (max-width: 479px){
#rc-imageselect, .g-recaptcha {transform:scale(0.75);
-webkit-transform:scale(0.75);
transform-origin:0 0;
-webkit-transform-origin:0 0;}
}
Author
Oops! You’re right, I left off the end bracket for the media query. I’ve added it in now. Thank you! :)
Helpful!
This is easy and awesome!
thanks for wonderful site.
BTW – how do you centered the re-captcha – or move it to the right side?
our site is RTL and we need either to center it or to shift it to the right side.
Best Regards,
Shimon
Thank you that worked great across all platforms! You are seriously touched. I checked the code for your website and it seems like you’re using wordpress. Did you make this theme from scratch?
Thanks, for sharing! Works for me.
Very Nice Solution
Thanks a bunch for sharing the knowledge. Really apprecaite it.
Hi. Stupid question: where I should add this code? :-))
Just found this and it’s awesome – thanks!
Dzięki ;-) – thanks!
Thank’s a lot!
Obrigado! (Thank You!)
It works perfectly on my site!
If needed, you could also add this block in your css file to eliminate unused blank space at right.
.g-recaptcha div {
width: 0 !important;
}
Thank you!
Hi,
I am at my wits end.
I am making a w3.css fully responsive website and the google recaptcha works fine in normal browsers but on my iPhone 6s after you click on “I’m not a robot” and the verify images pop-up appears, the focus of the web page goes all the wall down to the bottom of the page, so unless you scroll up again you don’t see that the verify images have appeared. Can you help me? The web site is in test mode at present but on the hosted server.
http://www.midwayboats.co.uk/midway2/contact-us2.html
thanks for this! It was very helpful to me!
I found that if on mobile you have an containing div that makes the actual available space less than the full width you need something like:
.g-recaptcha {
transform: scale(0.8);
-webkit-transform:scale(0.8);
transform-origin:0 0;
-webkit-transform-origin:0 0;
max-width: 240px;
}
and then set the max-width to what ever suits your site
Chris you’re a great help to me. Thank you so much! I was scratching my head as to why this was too small on mobile, and I just don’t have time to troubleshoot it. You’re a gem!
Thank you
Hey thanks!
Yes Its working…………………. :-) Thanks so much….
Life saver! Been struggling with this for more than an hour!
Hmm…. can i kiss you ? :3
Love you…
We could also add to /contact-form-7/modules/recaptcha.php the following code in function wpcf7_recaptcha_callback_script , just after var params = {…};
var is_mobile = Number(width) < 500 ? true:false;
params['size'] = is_mobile ? 'compact':'normal';
You can change 500 to whatever size you consider to be max for mobile window width.
This way for mobile version will have size as 'compact' while the desktop version will have size as 'normal'.
This could be particularly useful for those using it with contact-form-7 on wordpress, like me.
Really do not understand that Google(!) has no option like: ‘responsive’:’yes’ – Mobile First!!!!
Hi,
I’m not advanced in coding. Please tell me where to insert the code.
Thanks in advance
Thanks Geek Goddess.
I was looking for this sollution all day.
Thanks
Thank you! very useful!
The site name speaks for itself, the geekgoddess! Thanks. We found your site and its resolved. For those unsure, you can just add the CSS styles in any of your website stylesheet.
Cheers.
nice, its works
Thank you ;)
div[id|=”g-recaptcha”]
{
transform:scale(0.77);
-webkit-transform:scale(0.77);
transform-origin:0 0;
-webkit-transform-origin:0 0;
}
This worked for my on wordpress recaptcha build- Thank you :)
Beautiful.
This worked for my on drupal recaptcha build too Thank you :)
/* reCaptcha Responsivite */
@media screen and (min-width: 992px){
#rc-imageselect, .g-recaptcha {transform:scale(0.7);-webkit-transform:scale(0.7);transform-origin:0 0;-webkit-transform-origin:0 0;}
}
@media screen and (max-width: 991px){
#rc-imageselect, .g-recaptcha {transform:scale(1);-webkit-transform:scale(1);transform-origin:0 0;-webkit-transform-origin:0 0;}
}
@media screen and (min-width: 1200px){
#rc-imageselect, .g-recaptcha {transform:scale(0.9);-webkit-transform:scale(0.9);transform-origin:0 0;-webkit-transform-origin:0 0;}
}
Wow, great! Thanks!
Thank you…
Still so useful. Thx!
awesome! worked for me thanks!
Its really awesome solution
Thank you
the Geek Goddess
version 2.0 has added new attribute “data-size” with possible values of either “normal” (default) or “compact”
Author
Hi Dan,
Yes, that’s true – and has been mentioned a couple of times in this thread. However, this fix is for those of us who don’t want to use the compact version. This is a long thread though, so never hurts to mention again. :)
data-size=”compact” looks so ugly.. I prefer to use your fix. Thank you so much. You save my day! :-)
Your code is working.
Thanks G G.
Thank you, it help me well :).
saved my life
I went try all the CSS possible solutions suggested in this page and was not able to keep the reCaptcha from extending past the site container. Have not try the jquery function becasue I don’t know how to use it. How do you suggest I approach the problem?
WP 4.7
WP theme: responsivepro child
reCaptcha V2
You are the BEST!! thank you!!!
Great !! THX
Thank you.It works.
thank you its working
Ace! Thanks.
style>
#g-recaptcha-524 div {
transform:scale(0.891);
-webkit-transform:scale(0.891);
transform-origin:0 0;
-webkit-transform-origin:0 0;
}
/style>
Mega, thanks!
recaptcha not is responsive in width < 300 :/ you have solution ?????? thanks
Why you need width less than 300px….?
I am really most grateful to you that you have posted this article. This is a good solution….! Its really working on 320px width devices! I have searched on google a lot but not found any solution for the same excepting it.
Excellent! Thank you!!!
Really working good. Thanks !!!
Awesome. Thanks for the work.
Hello there! I have a big problem with those reCaptcha. I can’t even see it on my lap top. I tried everything ( different browsers, turn off firewall and windows defender, allow everything I could in google chrome and mozzilla, I try to resize it too, restart lap top, install latest version of browsers and java, java script, flash player, turn off every plugin, add on and extensions and still can’t see it. I can see it on another lap top and on my mobile.) So, can I write something like this in the ” inspect element ” to make it visible?
This is screen shot of where it should be a reCAPTCHA and ” inspect element” when I put a cursor on the invisible reCAPTCHA. I hope you will show up with some answer! Thanks in advance!
I dont understand where i must post this code? i’m novice in wp.
Hi,
how I can change this in Joomla system? Can you help me? I`m amateur for this.
Thanks
2 1/2 years later, still helping people with this post. Thank you!
Author
Thanks, Sean! :)
thank`s it it is very helpful for me
Dude. Saved. My. Life.
Thank you , very helpful code
It works this way by keeping it centralized on smartphones and we can line up right on tablets.
I’m using Bootstrap.
Sorry for my English.
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
.form-group-recaptcha {
position: relative;
height: 5.5em;
text-align: center;
}
.g-recaptcha {
transform: scale(0.95);
position: absolute;
width: 100%;
}
.g-recaptcha div {
width: 100% !important;
}
}
/* Small Devices, Tablets */
@media only screen and (min-width : 768px) {
.form-group-recaptcha {
text-align: right;
}
}
Nice one, very clever, Thanks
if I am using a dumb wordpress template, where exactly would I paste this? I have paste it in the css style sheet and nothing changed for the contact form. is there an alternate place to paste this? thanks
In your wordpress dashboard you have to go to the following route: appearence > editor.
Once you’re in, search the stylesheet (style.css) of your template.
Move to the last line of the code and paste something like this:
.g-recaptcha {
transform:scale(0.77);
-webkit-transform:scale(0.77);
transform-origin:0 0;
-webkit-transform-origin:0 0;
}
Then update file and… voilà!
Thank you! This made a huge diff, works beautifully.
Many thanks. your solution worked just fine.
Thank you!!!!! I was losing my mind trying to figure this out.
thak you so much.. It’s worked
What’s not resized is the question window that opens, asking to select sector of pictures
Thank you very much! :)
Thanks so much. A long journey in search of the solution is finished.
I put the code on my WordPress site, but it’s still overflowing on my iPhone 5S. I’m just wondering how I can fix this issue.
Great solutions…
Great tip. Thanks!
Thanks, very helpful!
by the way, google has added support for a smaller size via a parameter
https://developers.google.com/recaptcha/docs/display#config
together works perfect
I needed a bigger size; this worked great for that, too
I can’t figure out how to make this work. What file does it go into and where? Please help. Thank you.
Thanks. Works great with Contact Form 7 on WordPress. Just changed the scale a bit and it’s sorted.
Thanks you. This is the good solution.
Even when your solution worked sometimes. So, I came up with this solution based on yours:
http://jsfiddle.net/y3597/328/
Basically, the the recaptcha widget width is based by the container itself, not the screen size.
Please check it and let me know what you think about it! :)
Thanks you for the inspiration!
Thanks for sharing
Good trick, TY.
You should remove #rc-imageselect from example as it does nothing and is confusing.
Thank You very much. It as very usefull.
An excellent solution – Thank you for sharing :)
brilliant. i was sitting here trying to decide if i should just deal with it being cut off.
Nice good..thank you
Thank you so much! This is a great work around! Helped me so much!
Super Thanks
OLE from Spain!
Thank you!
Seems nice ty ;D
In bootstrap 4.0 you can simply do this
Thank you goddess, I was looking around for the solutions and then I got this, saved my day.
Thanks Goddess! :)
For iPhone6/7/8, I use the CSS below.
Centers the rounded rectangle and adds a grey band in the background, making it less awkward:
.g-recaptcha > div {
width: 100% !important;
text-align: center;
position: relative;
}
.g-recaptcha > div:before {
content: ”;
position: absolute;
top: 50%;
right: 0;
left: 0;
background-color: #f0f0f0;
height: 20px;
margin-top: -10px;
display: block;
z-index: 1;
}
.g-recaptcha iframe {
margin: 0 auto !important;
display: inline-block;
position: relative;
z-index: 2;
}
Author
Thank you! Will check this out.
Thanks. It works.
Thanks. Worked perfectly.
Good stuff just what I wanted. Interesting comments range over 3 years. Still not an ‘official’ solution. I like it as it does not need Javascript. Thanks again.
Nice! Thanks for that.
Thanks, this was very helpful!
Love it!
I was searching for this and finally got it,thank u for sharing the information.
I also want know how i can manage the size of the entire form.
Thanks. Worked perfectly!
Thank you for this! One would think that Google and Reacptcha would be able to address this issue given that user experience is so important, but…
WOW! what a amazing solution. Really loved it :)
I have used your solution so many times, I thought I would finally stop and say THANK YOU! This is an invaluable solution. I use it in sidebars, where the sidebar is too thin to fit the reCaptcha – and it works like a charm. Appreciate the solution!!!
Author
Thank you! :)
google reccomended method, use: data-size=”compact”
tested and works.
Thanks!!
Always helpful! Thank you!
thanks.. very helpfull
Saved my day.
Thanks a lot it’s very helpfull… It’s working fine
Most excellent, I wouldn’t have figured that out on my own.
Thanks for help for this solution.
best way to resize recaptcha.
Sexy … killer solution.
super. Was looking all over the net for this code- thanks Now my next search is customize the theme. Thanks once again.
I’am very grateful! Thanks!
thanks this work :)
You are a lifesaver. This solution worked perfectly!
Thank you!
Easy fix!
Much appreciated Goddess.
2019 and it still works. Great! Now if only we could make the recaptcha v3 work properly.
not working
Thank you
it’s working fine
Thank,
You are a lifesaver. This solution worked perfectly!
Thanks, man. 4 years later and this is still helpful and fully current!
Thank you
it’s working fine
Thanks a lot
Thanks – saved me a lot of time here.
Thanks. It worked
What is this number 0.77? I see that I have a code wherein I would like to transform the captcha widget to fit the width of my other buttons. Trying a jquery from other link.. but no luck so far.. How’s this working on mobile? The number 0.77? What is it scaling the widget with?
thank you
Easy fix!
Much appreciated Goddess.
Thank you very much. Works beautifully.
Author
Thank you! You have a beautiful website. Nicely coded.
Very Helpful
Thanks!
is there a way to position the image(I mean the image to verify i m not a robot) which gets displayed after clicking on that reCAPTCHA or clicking on the checkbox
Hi this looks like just what i need, i use captcha on a sidebox on my desktop site and its too wide for the sidebox can anyone help with how i would write this to scale the size on the desktop
Many Thanks
Thanks very helpful indeed
Great work!
I made a small change:
@media only screen and (max-width: 500px) {
.g-recaptcha {
transform:scale(0.77);
transform-origin:0 0;
}
}
Author
Thanks for this option, Frank! I’m amazed that this many years later we still need to do this. :)
thanks a lot.
Thanks, Thanks, Thanks
Love you!
I’m using elementor and it worked perfectly.
Thanks !
Thank you Goddess. It helps me with my Captcha on mobile. Good workaround.
Hi Jaime and all,
Happy new year ! :)
Here is the css I use, thank’s to the inspiration find on this post :
.g-recaptcha {
width: 0;
transform:scale(0.77) !important;
-webkit-transform:scale(0.77) !important;
}
I use it on wordpress + divi, width:0 help to align on left.
thanks
How can I do in Elementor, please help. Thank you.
great job
I’ve found a way of truly responsive implementation to resize google captcha element:
function resizeCaptcha() {
var captchaElem = document.getElementsByClassName(“g-recaptcha”)[0]
var captchaWidth = captchaElem.children[0].offsetWidth;
var parentWidth = captchaElem.parentElement.offsetWidth;
captchaElem.style.transform = “scale(” + (parentWidth / captchaWidth) + “)”;
captchaElem.style.transformOrigin = “0 0”;
};
grecaptcha.ready(resizeCaptcha);
addEventListener(“resize”, (event) => {resizeCaptcha()});
Author
Nice!