I've recently delved into the world of Bootstrap and CSS, but I'm facing a unique challenge. Despite my research efforts, I couldn't find a solution to my specific issue. I have a
<div class="col-md-6">
where I've nested two divs - one with the class "col-md-4" and the other with the class "col-md-2". Ideally, these child divs should align within the parent div on the same line, but for some reason, the second child div is being pushed down. I tried using style="display:inline" on the second child div, but it didn't yield the desired result. Strangely, when I remove the parent div with the class "col-md-6", everything works as expected. I'm puzzled as to why they aren't fitting within the parent div, especially considering its size.
The code below illustrates the issue:
<div class="row">
<div class="col-md-6">
<div class="col-md-4">
<input class="form-control" id="addItem" style="display: inline;">
</div>
<div class="col-md-2">
<button class="btn btn-default" style="display:inline;">submit</button>
</div>
</div>
</div>
In contrast, this example functions correctly:
<div class="row">
<div class="col-md-4">
<input class="form-control" id="addItem" style="display: inline;">
</div>
<div class="col-md-2">
<button class="btn btn-default" style="display:inline;">submit</button>
</div>
</div>