I would like to add text which displays over an image.
Essentially, this what my code looks like:
-
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>
讨论(0)
-
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:
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/
讨论(0)
-
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
讨论(0)