Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid "-internal-autofill-selected" style to be applied?

I have a login form with 2 fields, username and password. Username field is autocompleted by chrome. When I submit the form (when it is valid), this style is applied mysteriously:

input:-internal-autofill-selected {s ñ
    background-color: rgb(232, 240, 254) !important;
    background-image: none !important;
    color: -internal-light-dark-color(black, white) !important;
}

Is there a way to avoid that? The form is submitted using Ajax, so it is a little ugly if for Username field that style is applied, but for Password field it is not.

I noticed that this happen only if field is filled with an element in the chrome sugggestions list. If field is filled with a value that is not in the list, the style is not applied.

Regards Jaime

like image 233
jstuardo Avatar asked Apr 07 '20 15:04

jstuardo


People also ask

How to remove applied styles in Bootstrap?

Override the applied styles for that particular element. You can customize your bootstrap... To remove style you can use removeAttr property over the selector If you are not using inline style then you need to override the propeties in css The style is applied via css from the stylesheet, not inline.

How do I remove an applied style from a Word document?

If the “Styles” pane is open, you can also clear any applied style from there, as well. To open the pane, click the “Styles” pane launcher button in the “Styles” button group of the “Home” tab. Then select the text from which you want to remove the style in the document.

Are your styles not working like they’re supposed to?

As you can see, when you’re styles aren’t “working like they’re supposed to” you don’t have to resort the !important tag. You have other options. In fact, it’s strongly recommended that you avoid using the !important tag in the vast majority of cases.

How do I change the style of a style?

Hover the mouse pointer over a style name in the Styles window. You should see a down-arrow appear at the right side of the style name. Click the down arrow and select Modify.


2 Answers

To get rid of the undesired behavior, this trick "just works" (tm):

  input:-webkit-autofill,
  input:-webkit-autofill:focus {
    transition: background-color 600000s 0s, color 600000s 0s;
  }
like image 178
Kostiantyn Ko Avatar answered Sep 20 '22 19:09

Kostiantyn Ko


You can add a box-shadow to remove the blue background

box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px rgba(255, 255, 255,1);
like image 24
rakesh kr Avatar answered Sep 19 '22 19:09

rakesh kr