ReCaptcha API v2 Styling

前端 未结 18 1823
孤城傲影
孤城傲影 2020-11-28 02:59

I have not had much success finding how to style Google\'s new recaptcha (v2). The eventual goal is to make it responsive, but I am having difficulty applying styling for ev

18条回答
  •  眼角桃花
    2020-11-28 03:30

    I came across this answer trying to style the ReCaptcha v2 for a site that has a light and a dark mode. Played around some more and discovered that besides transform, filter is also applied to iframe elements so ended up using the default/light ReCaptcha and doing this when the user is in dark mode:

    .g-recaptcha {
        filter: invert(1) hue-rotate(180deg);
    }
    

    The hue-rotate(180deg) makes it so that the logo is still blue and the check-mark is still green when the user clicks it, while keeping white invert()'ed to black and vice versa.

    Didn't see this in any answer or comment so decided to share even if this is an old thread.

提交回复
热议问题