Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting Divs Next to each other using bootstrap

I have tried using the row class but it was not solving the problem. I am just trying to take two divs and put them next to each other using only bootstrap and not css. (It's a corner case where I can't add any css) Is there a way to do this?

Basically I have this:

<div class="OuterMostClass row">
    <div class="outerClass">
        <button class="btn">button1</button>
    </div>
    <div class="outerClass2">
        <button class="btn">button2</button>
    </div>
</div>

And I want the two buttons to be next to each other and due to limitations I can't add any css other than bootstrap. Is this possible?

like image 815
ford prefect Avatar asked Jun 11 '14 18:06

ford prefect


People also ask

How do I align two divs next to each other?

With CSS properties, you can easily put two <div> next to each other in HTML. Use the CSS property float to achieve this. With that, add height:100px and set margin.


2 Answers

Your code sample doesn't show a parent div with the container or container-fluid class and your columns are missing size classes.

Try this:

<div class="container">
    <div class="OuterMostClass row">
        <div class="outerClass col-xs-6">
            <button class="btn">button1</button>
        </div>
        <div class="outerClass2 col-xs-6">
            <button class="btn">button2</button>
        </div>
    </div> 
</div>
like image 156
Matthew Avatar answered Sep 29 '22 10:09

Matthew


The answer is to add the pull-left class to the buttons but as Matthew points out adding a container makes it easier to take care of other spacing

like image 45
ford prefect Avatar answered Sep 29 '22 08:09

ford prefect