1
Good afternoon!
I don’t have much experience with frontend, but I’ll have to turn around to finish a project, so I’ll need a little help.
My question is, I have a few presses on the screen, and I would like it to be aligned under each other, but I can’t get it for you at all.
As you can see, speed and summary I can not align, and tb can not standardize the size of fields.
I’m using the css 3 that the visual studio scaffolding uses
<div class="form-inline">
<div class="form-group">
@Html.LabelFor(model => model.Barco.Nome, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.EditorFor(model => model.Barco.Nome, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.Nome, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Barco.SapId, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-9">
@Html.EditorFor(model => model.Barco.SapId, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.SapId, "", new { @class = "text-danger" })
</div>
</div>
div class="form-group">
@Html.LabelFor(model => model.Barco.CapacidadeAgua, htmlAttributes: new { @class = "control-label col-md-10" })
<div class="col-md-8">
@Html.EditorFor(model => model.Barco.CapacidadeAgua, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.CapacidadeAgua, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Barco.CapacidadeOleo, htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-11">
@Html.EditorFor(model => model.Barco.CapacidadeOleo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.CapacidadeOleo, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Barco.Velocidade, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.EditorFor(model => model.Barco.Velocidade, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.Velocidade, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Barco.Resumo, htmlAttributes: new { @class = "control-label col-md-6" })
<div class="col-md-7">
@Html.EditorFor(model => model.Barco.Resumo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.Resumo, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Barco.Setor, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-10">
@Html.EditorFor(model => model.Barco.Setor, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Barco.Setor, "", new { @class = "text-danger" })
</div>
</div>
Come back
Dude you have to put col-Md-12 in EVERYTHING. Any class that is with col-Md-XX vc should replace the number by 12 getting all classes with col-Md-12, this can help you, because looking at the top seems meaningless the way you used the values of these columns of the grid..., but as you want everything in a column only using col-Md-12 must resolve...
– hugocsl
Got it, thanks for the help. It was like I said, I only do backend, I’m doing front, because there’s no one. But taking the opportunity, what was the point in putting the columns in 12? I know you have the division that bootstrap does, but I never got it right
– Janson
Here’s the official Bootstrap Grid documentation. It is very easy to understand, it is worth stopping 5 min to read https://getbootstrap.com/docs/4.0/layout/grid/ vc you will see that for example two Divs with the class col-Md-6 will generate two equal columns with width of 50% each. Already two columns with col-Md-12, will generate only one column, with each div occupying 100% of the width.
– hugocsl