I've been trying my best to center a div that contains a form .form-group
inside another div #myCarousel
, responsively both vertically and horizontally. (works across different device widths)
I've tried absolute
positioning with pixels, percentage - but that didn't work. I tried making the form a child element inside the #myCarousel
, but I wasn't able to make it work.
My goal is to make the form in the exact center of the caraousel (over the image slider) and have the images sliding in background, while the form stays fixed in the center.
Here is what my code looks like. Codepen Link
<div id="myCarousel" class="carousel slide" data-ride="carousel">
...
</div>
<div class="form-group">
<form action="thank-you.php" method="post">
<input class="form-control" type="text" name="name" placeholder="Enter your name">
<input class="form-control" type="text" name="mobile" placeholder="Enter mobile number">
<input class="form-control" type="text" name="email" placeholder="Enter your email address">
<input class="form-control" type="text" name="address" placeholder="Enter your area and landmark">
<select id="multi-select" name="products[]" multiple="multiple">
<option value="product1">Product 1</option>
<option value="product2">Product 2</option>
<option value="product3">Product 3</option>
</select>
<input type="submit">
</form>
</div>
I'd be glad if you'll could guide me here.