how to display text over an image in Bootstrap 3.1

how to display text over an image in Bootstrap 3.1

I would like to add text which displays over an image.
Essentially, this what my code looks like:

TITLE HERE

Let us build your preview for free

this is a test

I cannot manage to get “this is a test” onto the proposed section of the image.
I would like to use the parameters of bootstrap.min.css to keep everything consistent. Also, since this will be a responsive design website, I am wanting the text to be responsive with the image so that it does not lose its position
If anyone could help, that would be great 🙂

Solutions/Answers:

Solution 1:

I can suggest a way to go around the question: you can use a carousel with a single item, because you can insert text on carousel images thanks to captions:

<div id="mycarousel" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">
        <div class="item active">
        <img src="img/yourimage.png" alt="" class="img-responsive">
           <div class="carousel-caption">
           Insert your text here !
           </div>
        </div>
    </div>
</div>

Solution 2:

You will need to paste additional css to give us an idea of what you’re dealing with exactly, but here’s my 2 cents anyway:

Related:  Bootstrap 3 Navbar won't collapse on mobile browsers but will in undersized desktop window

1) Start by placing the image and the text in something that will contain them both:

<div class="imageAndText">
    <img src="img/img/flow-1.png" class="align-center img-responsive">
    <div class="col">
        <div class="col-sm-4">
            <p>this is a test</p>
        </div>
    </div>
</div>

(Careful, your original code has an extra )

2) Add absolute positioning + z-index:

.imageAndText {position: relative;} 
.imageAndText .col {position: absolute; z-index: 1; top: 0; left: 0;}

Here’s a jsFiddle illustrating: http://jsfiddle.net/sX982/

Solution 3:

I don’t think this is possible using bootstrap classes. You can just do something like this by adding thumbnail to the image and thumbnail_legend to the next div.

.thumbnail_legend {
    background: none repeat scroll 0 0 #FFFFFF;
    opacity: 0.5;
    top:0;
    left:0;
    position: absolute;
}

.thumbnail {
    position:relative;
}

from: Bootstrap 3: Text overlay on image

References