[Django]-Django-Simple-Captcha add CSS

3πŸ‘

If you don’t want to change the pattern for all the captchas, you could use a workaround.
Since the captcha by default is displayed like:

<input autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" id="id_captcha_1" name="captcha_1" type="text">

you can take the β€œid_captcha_1” and write your custom css code for example:

#id_captcha_1{
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    }
πŸ‘€palamunder

0πŸ‘

hi you can override in your template:

captcha/text_field.html

and add your custom class to html code in text_field.html simple:

<input autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" id="{{id}}_1" name="{{name}}_1" class="white-text" type="text" />

refrence to documention

πŸ‘€user2604098

0πŸ‘

update captcha css for admin login

create file templates/admin/css/base.css

then add #id_captcha_1 and captcha class in base.css

like:

#id_captcha_1{
margin-top: -26px;
margin-left: 98px;
height: 21px;
}

.captcha {
 padding-top: 22px
}
πŸ‘€Ankit Patidar

Leave a comment