Email or username:

Password:

Forgot your password?
Top-level
Amadeus Maximilian

@noleli I’m assuming this works, because the user specified styles get applied first, because the !important of the user agent stylesheet makes it kick in last? And that’s how the initial state of the transition is set?

I never thought of !important styles being applied *after* regular ones in a “time” sense. 😅

6 comments
Noah Liebman

@amxmln it’s not a time thing, but a precedence thing. The cascade (origin, specificity, layers, etc.) determines which styles are applied. A feature of the cascade is that active transitions take precedence over everything else. Essentially it’s telling something “take forever to get to your destination even if your destination is really high priority.”

Amelia Bellamy-Royds

@noleli @amxmln Ah, but Amadeus has a point: In order to have a transition, it's not enough to have multiple styles competing in the cascade. There has to be an initial time when those styles didn't apply.

Unless you use the new @ starting-style rule, but I don't think that's well supported yet.

Noah Liebman

@AmeliaBR @amxmln that’s a good point. in this case, author styles are applied initially, and only once someone tries to autofill and the proprietary pseudoclass gets applied does it (try to) go to the !important UA styles. I should clarify that in my post, because this trick only works under those circumstances.

Amelia Bellamy-Royds

@noleli @amxmln Also, separate issue: but I hope you have a real good reason for overriding user agent !important styles if you're using this in practice & not as just a weird CSS trick.

Noah Liebman

@AmeliaBR totally. I may have missed it, but I didn’t see in the spec that a UA must make clear that a field has been autofilled. That said, I could imagine it being a security concern if it doesn’t. Certainly warrants more discussion with the design team.

Amadeus Maximilian

@noleli @AmeliaBR thank you for clarifying. 😊 I think I got it now. 👍

Go Up