I am using Bootstrap and i want to align an image and a table "side-by-side" in the same column.
HTML code:
<div class="col-md-10" style="width: 100%">
<img src="#" class="img-responsive pull-left pro-page-pro-image">
<div class="container">
<table class="table table-responsive pull-right pro-page-contact-details-table">
<tbody>
<!---the table has 12 rows in total -->
<tr>
<td>MEMBER SINCE</td>
<td>2007</td>
</tr>
<tr>
<td>Suburb</td>
<td>Fourways, Randburg</td>
</tr>
</tbody>
</table>
</div>
</div>
The relevant CSS:
.pro-page-pro-image {
display:inline;
margin-top: 4%;
margin-left: 11%;
margin-right: 11%;
margin-bottom: 4%;
}
.pro-page-contact-details-table {
display: inline;
}
The classes .table
and .table-responsive
are standard bootstrap classes. At the moment in the browser the table is positioned directly below the image (both left aligned) and despite trying numerous things I can't get them to align side-by-side.
Any pointers would be greatly appreciated.
I think it should be this:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="col-md-10" style="width: 100%">
<div class="row">
<div class="col-md-6">
<img src="https://dummyimage.com/300x200/000/fff" class="img-responsive pull-left pro-page-pro-image">
</div>
<div class="col-md-6">
<table class="table table-responsive pull-right pro-page-contact-details-table">
<tbody>
TABLE HERE
</tbody>
</table>
</div>
</div>
</div>
you need to use a ROW and in the row u define the columns. 6+6 = the 12 max so it should align now. and if u use container. it will use the full width of the screen so then you cant allign stuff.