Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap - How to make text wrap around an image on small devices?

I'm just getting started with Bootstrap. Below is a snapshot of my page.

enter image description here

My CSS is

.snippet img{
width: 150px;
max-width: 100%;
height:auto;


 }

@media(max-width: 767px) {
.snippet img{

    width:100px;
    float: right;
    max-width: 100px;
    height: auto;
    margin-left: 10px;
    margin-right: 10px;
    }
}

And here is my HTML:

<h2>About the venue</h2>
<div class="media-body snippet" >
    <a class="pull-right" href="venue.php">
            <img  src="images/venue.jpg" alt="illustration"></a>
    <p>this is the paragraph ... </p>       
</div>

I want the image to be hanging like that on big screen. However, on small devices I would like to get the text to wrap around the image. How can I do that?

Any help would be appreciated!

like image 773
beginning Avatar asked Dec 19 '13 07:12

beginning


3 Answers

why you dont use this? its also smarter ;) http://getbootstrap.com/components/#thumbnails-custom-content

EDIT

include code from bootstrap doc

<div class="row">
<div class="col-sm-6 col-md-4">
    <div class="thumbnail">
        <img data-src="holder.js/300x200" alt="...">

        <div class="caption">
            <h3>Thumbnail label</h3>

            <p>...</p>

            <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
        </div>
    </div>
</div>

like image 152
MaiKaY Avatar answered Oct 06 '22 22:10

MaiKaY


Try this

<div style="width: 150px;">
<img src="http://i.stack.imgur.com/Fa34B.png" align="left" width="100" height="100"> This is text  This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text This is text
  </div>
like image 23
Vikas Sharma Avatar answered Oct 07 '22 00:10

Vikas Sharma


I just use the following: float is all that's needed, a bit of padding for visuals:

<div class="float-right pl-3 pb-3">
    <img src="https://i.pinimg.com/474x/4a/c7/3b/4ac73b5c8ef5d397ab535ac1631642a7.jpg" class="shadow img-fluid">
</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
like image 1
Paul Zahra Avatar answered Oct 06 '22 23:10

Paul Zahra