ASP.NET 核心 MVC 标签标签助手

ASP.NET Core MVC Label Tag Helper

我正在构建我的 web razor 视图,但 Label Tag Helper 有问题。

这是我的标记:

<label asp-for="customer.FirstName" class="col-sm-2 col-form-label">First Name</label>

问题是 First 和 Name 显示在不同的行中,我希望它们在一行中显示。如果这是一个简单的问题,我们深表歉意;我是新手。

非常感谢您的帮助,

您需要调整列大小(class 属性),例如:

<label asp-for="customer.FirstName" class="col-md-4 col-form-label">First Name</label>

了解 bootstrap 的 网格系统 的工作原理可能对您有用: https://getbootstrap.com/docs/4.0/layout/grid/
https://www.c-sharpcorner.com/article/bootstrap-for-beginners-part-threebootstrap-grids/