gpt4 book ai didi

css - 如何在 mvc razor 中对齐编辑器的文本框?

转载 作者:太空宇宙 更新时间:2023-11-03 21:42:41 24 4
gpt4 key购买 nike

我有 Razor EditorFor<> 为我创建了一些文本框,但对齐方式很糟糕,我无法正确调整它。

enter image description here

我如何对齐所有文本框以与文本开始相同的距离?

查看:

<div style="float: left; width: 50%;">

@Html.LabelFor(m => m.Date)
@Html.EditorFor(m => m.Date)
<br/>
@Html.LabelFor(m => m.QuoteNumber)
@Html.EditorFor(m => m.QuoteNumber)
<br/>
@Html.LabelFor(m => m.ClaimNumber)
@Html.EditorFor(m => m.ClaimNumber)
<br/>
@Html.LabelFor(m => m.MotorBodyRepairer)
@Html.EditorFor(m => m.MotorBodyRepairer)
<br/>

</div>
<div style="float: right; width: 50%;">

@Html.LabelFor(m => m.VehicleRegistration)
@Html.EditorFor(m => m.VehicleRegistration)
<br/>
@Html.LabelFor(m => m.VehicleMake)
@Html.EditorFor(m => m.VehicleMake)
<br/>
@Html.LabelFor(m => m.VehicleRange)
@Html.EditorFor(m => m.VehicleRange)
<br/>
@Html.LabelFor(m => m.VehicleModel)
@Html.EditorFor(m => m.VehicleModel)
<br/>

</div>

型号:

namespace SpendDirect.WebUI.Models.ViewModels
{
public class APNewQuoteViewModel
{
[Display(Name = "Date")]
public DateTime Date { get; set; }

[Display(Name = "Quote Number")]
public string QuoteNumber { get; set; }

[Display(Name = "Claim Number")]
public string ClaimNumber { get; set; }

[Display(Name = "Motor Body Repairer")]
public string MotorBodyRepairer { get; set; }

[Display(Name = "Vehicle Registration")]
public string VehicleRegistration { get; set; }

[Display(Name = "Vehicle Make")]
public string VehicleMake { get; set; }

[Display(Name = "Vehicle Range")]
public string VehicleRange { get; set; }

[Display(Name = "Vehicle year Model")]
public string VehicleModel { get; set; }

}
}

最佳答案

你可以这样使用:

@Html.LabelFor(model => model.TITLEID, htmlAttributes: new { @class = "control-label col-md-2" , @style = "float: left;text-align: left;" })

关于css - 如何在 mvc razor 中对齐编辑器的文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22533007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com