我的頁面上有以下代碼:
<div class="form-group row">
<div class="col-md-3">
<label asp-for="id" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="id" class="form-control" />
<span asp-validation-for=id" class="text-danger"></span>
</div>
<div class="col-md-1">
<label class=" control-label " style="font-weight:bold;">OR</label>
</div>
<div class="col-md-3">
<label asp-for="EmailAddress" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="EmailAddress" class="form-control" />
<span asp-validation-for="EmailAddress" class="text-danger"></span>
</div>
<div class="col-md-1">
<label class=" control-label " style="font-weight:bold;">OR</label>
</div>
<div class="col-md-3">
<label asp-for="Customer" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="Customer" class="form-control" />
<span asp-validation-for="Customer" class="text-danger"></span>
</div>
<div class="col-md-1">
</div>
</div>
當我運行代碼時,它看起來像這樣
我正在嘗試將& quot或者& quot在中間。我不想& quot或者& quot像圖中顯示的那樣漂浮在頂部。
我想你正在使用引導程序
我還修復了asp-validation-for屬性,請始終檢查您的標記
只需對齊或標簽
<link rel="stylesheet"/>
<div class="form-group row">
<div class="col-md-3">
<label asp-for="id" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="id" class="form-control" />
<!-- fixed asp-validation-for attribute -->
<span asp-validation-for="id" class="text-danger"></span>
</div>
<!-- Align the tags -->
<div class="col-md-1 d-flex align-items-center justify-content-center">
<label class="control-label " style="font-weight:bold;">OR</label>
</div>
<div class="col-md-3">
<label asp-for="EmailAddress" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="EmailAddress" class="form-control" />
<span asp-validation-for="EmailAddress" class="text-danger"></span>
</div>
<div class="col-md-1 d-flex align-items-center justify-content-center">
<label class=" control-label " style="font-weight:bold;">OR</label>
</div>
<div class="col-md-3">
<label asp-for="Customer" class=" control-label " style="font-weight:bold;"></label>
<input asp-for="Customer" class="form-control" />
<span asp-validation-for="Customer" class="text-danger"></span>
</div>
<div class="col-md-1">
</div>
</div>