.field:invalid { border-color: #dc2626; }An incomplete or empty required email receives a red border.
LESSON 87 OF 100
Change the border of an email field that fails HTML validation.
:invalid matches a control whose HTML constraints are not satisfied. Colour is extra visual feedback; messaging and semantic error association require separate logic in a real form.
.field:invalid { border-color: #dc2626; }An incomplete or empty required email receives a red border.
.field { border-color: #dc2626; }A permanent red border does not reflect the control validation result.
Set border-color: #dc2626 only for .field:invalid.
The pseudo-class reads the validity state established by the email type and required attribute.
ANALYSIS REQUEST
The initial discussion is without obligation. You receive an honest recommendation, suitable stages and the factors that affect price.