how to display text over an image in Bootstrap 3.1

前端 未结 3 1702
无人及你
无人及你 2020-12-30 02:22

I would like to add text which displays over an image.

Essentially, this what my code looks like:

3条回答
  •  再見小時候
    2020-12-30 03:12

    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:

    this is a test

    (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/

提交回复
热议问题