我想将必填字段符号(星号)的颜色更改为红色

问题描述 投票:0回答:1

我想将必填字段符号(星号)的颜色更改为红色。我正在使用 Mud-Blazor。我使用下面的代码尝试了它。 this is the image after i apply the code 这是我用于星号以红色显示的代码。

<style>
 .mud-input-required::before {
  content: "*";
  color: red;
  margin-right: 2px;
    }

  .mud-label {
   display: flex;
   align-items: center;
    }
</style>
asp.net-core validation required mudblazor
1个回答
0
投票
<MudTextField @bind-Value="HelperText" Class="red-asterisk-required" Label="With Helper" Variant="Variant.Outlined" />
<br>
<MudTextField @bind-Value="HelperText" Label="With Helper" Variant="Variant.Outlined" />

<style>
.red-asterisk-required .mud-input-label::after {
    content: " *";
    color: red;
}
</style>

@code {
    public string HelperText { get; set; }
}

参考此链接https://try.mudblazor.com/snippet/wOQIEbEdfXffXybS

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.