Styling ASP.NET MVC validation errors?

前端 未结 2 582
终归单人心
终归单人心 2021-02-02 17:32

Can ASP.NET MVC\'s validation errors be styled? Where? I tried editing .input-validation-error class in Site.css but that didn\'t have any effect.

pom

2条回答
  •  有刺的猬
    2021-02-02 18:04

    If you style up .field-validation-error then this will change the validation error text messages.

    .field-validation-error{ color: red; font-weight: bold; }
    

    If you style up .input-validation-error then this will change the input style when there is a validation error.

    .input-validation-error{ background: pink; border: 1px solid red; }
    

提交回复
热议问题