ford prefect
ford prefect

Reputation: 7388

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?

Upvotes: 6

Views: 6281

Answers (2)

ford prefect
ford prefect

Reputation: 7388

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

Upvotes: 1

Matthew
Matthew

Reputation: 8416

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>

Upvotes: 5

Related Questions