Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2 div next to each other in bootstrap

I'm trying to show two divs next to each other using Bootstrap, but there is a distance between them. How can i place them exactly next to each other.

The code:

<div class="col-lg-8 col-lg-offset-2 centered">
    <div style="float: left; border: 1px solid; width: 227px; height: 50px;"></div>
    <div style="float: right; border: 1px solid;width: 227px; height: 50px;"></div>
</div>

Image illustration:

enter image description here

like image 386
user3423384 Avatar asked May 15 '14 19:05

user3423384


People also ask

How do I put 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.

How do I align two divs side by side?

The most common way to place two divs side by side is by using inline-block css property. The inline-block property on the parent placed the two divs side by side and as this is inline-block the text-align feature worked here just like an inline element does.

How do I put elements side by side in Bootstrap?

Put the Like, Info and Delete buttons side-by-side by nesting all three of them within one <div class="row"> element, then each of them within a <div class="col-xs-4"> element. The row class is applied to a div, and the buttons themselves can be nested within it.


1 Answers

Look into grids in Bootstrap.

You could do something like this:

<div class="row">
    <div class="col-xs-6">div 1</div>
    <div class="col-xs-6">div 2</div>
</div>
like image 184
lschlessinger Avatar answered Sep 22 '22 16:09

lschlessinger