0
Hello, everybody.
I’m starting with front-end web programming and I have a question about Bootstrap 4, and its grid system. Basically how to center the input
and the p
inside the Grid.
I have the code below:
<div class="container-fluid mt-2">
<div class="row">
<div class="col-md-2 offset-md-1">
<a href="http://placehold.it"><img src="http://placehold.it/200x150"></a>
</div>
<div class="col-md-6 pt-5">
<div class="input-group">
<input type="text" class="form-control">
</div>
</div>
<div class="col-md-3">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
</div>
</div>
What I want is basically to center this input
and the p
inside the grid, so that it is next to the 200x150 image (which when increasing the image, the size of the row
also increases, leaving the other elements at the top). I managed to do this by placing inside the class <div class="col-md-6">
the pt-5
, but it gives a padding-top of 5, getting kind of a "gambiarra" and not centering inside the Grid properly.
I wonder if there is any way to centralize input without using the pt-5
inside the class to make the spacing of the top part.
Thank you!
Hi, thanks for the answer. Basically does not meet what I need, because what I want is to center in the middle of the Grid so that changes the padding and I would like to know if there is any class for this, not just change the orientation of the paragraph/image to the center.
– L. Alves
You want to center vertically in relation to the image size?
– Jessika
That, I intend to center the form and paragraph vertically in relation to the size of the image that occupies the first two columns.
– L. Alves