I built a website with bootstrap 3, it has a news section where each news article should look like the following:
mobile-first:
------------
| Title |
------------
------------
| Img |
------------
------------
| Content |
| Content |
------------
on bigger screens:
---------------------------
| Img | Title |
| |------------------
|-------| Content |
| | Content |
---------------------------
I don't want the content to float around the image, it should stay in its column, that is why I seek to solve this with bootstrap.
I already asked a question about this - and found a solution - which I now see is not perfect. question.
If I use the following code:
<div class="container">
<div class="row">
<div class="col-md-8 col-md-push-4">Title</div>
<div class="col-md-4 col-md-pull-8">Img<br>IMg<br>sdf<br>sdf<br>sdf<br>sdf<br>sdf<br>sdf<br>sdf<br></div>
<div class="col-md-4 col-md-push-4">Content<br>content<br>content<br>content<br>content<br>content</div>
</div>
</div>
I get:
---------------------------
| Img | Title |
| |------------------
|-------|
|-------|------------------
| | Content |
| | Content |
---------------------------
While the img-columns floats as it should, the content column does not. Why is that?
I added a code snippet for that:
[class*="col"]{
border: 1px solid black;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-push-4">Title</div>
<div class="col-sm-4 col-sm-pull-8">Img<br>Img<br>Img<br>Img<br>Img<br>Img<br>Img<br>Img<br>Img<br></div>
<div class="col-sm-4 col-sm-push-4">Content<br>content<br>content<br>content<br>content<br>content</div>
</div>
</div>