I am coding a MVC 5 view, and have a question in regards to the width of two view elements.
Here is a picture of the view:
Here is my code:
<div class="form-group">
@Html.LabelFor(model => model.width, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="input-group spinner">
@Html.EditorFor(model => model.width, new { htmlAttributes = new { @class = "form-control" } })
<div class="input-group-btn-vertical">
<button type="button" id="inputSpinnerUpWidth" class="btn btn-default"><i class="fa fa-caret-up"></i></button>
<button type="button" id="inputSpinnerDownWidth" class="btn btn-default"><i class="fa fa-caret-down"></i></button>
</div>
</div>
@Html.ValidationMessage("assetwidth")
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.height, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="input-group spinner">
@Html.EditorFor(model => model.height, new { htmlAttributes = new { @class = "form-control" } })
<div class="input-group-btn-vertical">
<button type="button" id="inputSpinnerUpHeight" class="btn btn-default"><i class="fa fa-caret-up"></i></button>
<button type="button" id="inputSpinnerDownHeight" class="btn btn-default"><i class="fa fa-caret-down"></i></button>
</div>
</div>
@Html.ValidationMessage("assetheight")
</div>
</div>
The Width
and Height
elements are not the same width as the other form controls. How can I get the two input-group spinner
elements to be the same width as the other form controls?
Here is the view code for the "Asset name"
HTML element:
<div class="form-group">
@Html.LabelFor(model => model.name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" })
</div>
</div>
Thanks in advance.
EDIT
Here is the spinner css code:
.spinner input {
text-align: right;
}
.input-group-btn-vertical {
position: relative;
white-space: nowrap;
vertical-align: middle;
display: table-cell;
}
.input-group-btn-vertical > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
padding: 8px;
margin-left: -1px;
position: relative;
border-radius: 0;
}
.input-group-btn-vertical > .btn:first-child {
border-top-right-radius: 4px;
}
.input-group-btn-vertical > .btn:last-child {
margin-top: -2px;
border-bottom-right-radius: 4px;
}
.input-group-btn-vertical i{
position: absolute;
top: 0;
left: 4px;
}
In the Site.css, there is the following code:
input,
select,
textarea {
max-width: 280px;
}
How can I add the input-group spinner
to the above CSS?
I have tried the following:
input,
select,
spinner,
textarea {
max-width: 280px;
}
Add this to your CSS
.spinner {
width: 280px;
}