如何避免引导标签溢出 .NET 8 上的日期选择器输入?

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

我正在遵循有关向身份用户添加自定义属性的 Microsoft 身份教程。我已经添加了微软文档建议的更改,但是我遇到了一个小的视觉错误。

代码如下:

<div class="form-floating mb-3">
    <label asp-for="Input.DOB"></label>
    <input asp-for="Input.DOB" class="form-control" />
    <span asp-validation-for="Input.DOB" class="text-danger"></span>
</div>

这就是我所看到的:

Register view

我尝试过检查引导文档并添加填充,但我不确定对此最优雅的修复是什么

c# html .net razor bootstrap-5
1个回答
0
投票

原因

enter image description here

更改您的 Register.cshtml,如下所示。

<div class="form-floating">
    <label asp-for="Input.Name"></label>
    <input asp-for="Input.Name" class="form-control" />
    <span asp-validation-for="Input.Name" class="text-danger"></span>
</div>
<div class="form-floating">
    <input asp-for="Input.DOB" class="form-control" />
    <label asp-for="Input.DOB"></label>    
    <span asp-validation-for="Input.DOB" class="text-danger"></span>
</div>

测试结果

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.