Firefox 4 : Is there a way to remove the red border in a required form input?

后端 未结 7 589
一整个雨季
一整个雨季 2020-12-04 16:24

When required is defined in a form field, Firefox 4 automatically shows a red border to this element, even BEFORE the user hits the submit button.



        
7条回答
  •  感动是毒
    2020-12-04 16:54

    As of Firefox 26, the actual CSS used to identify invalid required fields is as follows (comes from forms.css):

    :not(output):-moz-ui-invalid {
        box-shadow: 0 0 1.5px 1px red;
    }
    

    To replicate in other browsers, I use:

    input:invalid {
        box-shadow: 0 0 1.5px 1px red;
    }
    

    I played around with the pixel settings but I never would have guessed the 1.5px without looking at moz source.

    To disable it, you can use:

    input:invalid {
        box-shadow: none;
    }
    

提交回复
热议问题