Reputation: 5943
On my form I have two fields like so:
<div class="form-group">
@Html.LabelFor(model => model.City, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.City, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.City, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.Label("State", new { @class = "control-label col-md-2" })
<div class="col-md-4">
<div class="tt-container">
@Html.Editor("StateName", new { htmlAttributes = new { @id = "StateName", @class = "form-control" } })
</div>
@Html.ValidationMessageFor(model => model.StateId, "", new {@class = "text-danger"})
</div>
<div class="alert alert-dismissible alert-warning col-md-6">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Warning!</h4>
<p>Please select the state the appears as you continue to type in the state where you are from.</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.EmailAddress, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.EmailAddress, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.EmailAddress, "", new { @class = "text-danger" })
</div>
</div>
On the view it looks like so:
How do I make it so that there is the same space between the State input field and the email input field, just like the amount of space between city and state input fields?
Upvotes: 1
Views: 293
Reputation: 6699
.container{
display: flex;
justify-content: center;
align-items: center;
}
.alert{
min-width:250px;
}
<link href="https://getbootstrap.com/docs/3.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row container">
<div class="col-md-3 col-sm-4 col-xs-6"><form class="form-inline">
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="col-md-3 col-sm-4 col-xs-6 container">
<div class="alert alert-info">alert</div>
</div>
</div>
Upvotes: 1