In an web application, i am displaying posts from other users in an individual user’s homepage. Each post will contain the thumbnail profile picture of the person the post is from, their name on a paragraph, text contents and then a reply box and button. I am trying to do this by bootstrap’s grid system but not achieving the desired effect. I want to mimic the tweets in twitter home page, but in my case there is a big gap in between the profile picture and the other column.
<div class="container" >
<ul id="newsfeed">
<li>
<div class="row">
<div class="col-sm-2">
<img src="someimage.png" class="img-thumbnail" alt="Some Image" width="60" height="60">
</div>
<div class="col-sm-4">
<p>9gag@9gag</p>
<p>This is me</p>
<p>twitted at 12:30pm GMT6+</p>
</div>
</div>
</li>
</ul>
</div>
2
Answers
Your
.col-sm-2
is wider than your thumbnail image you can do two things.1) You can can use
.col-sm-1
for the image container.2) You can leave it as is but add bootstraps helper class
pull-right
to your img tag.CODEPEN DEMO
You could use the Media Object component for this (and possibly without any additional CSS as far as structure is concerned).
See working example Snippet.