Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overlay/embed bootstrap button on image?

I have been searching the web but can't find the answer. Is it possible to overlay or embed a bootstrap button over/in an image? If so, how?

I have a image that I want to overlay a bootstrap button over so it looks like it is embedded in the image. I would like the button to have a dynamic label on it(for ex. somebody's name).

like image 479
fat fantasma Avatar asked May 17 '13 17:05

fat fantasma


People also ask

How do I overlap an image button?

Set the position property value for the parent to relative (to control overlap) and that of the button DIV to absolute . Now place your button inside the button DIV , then use negative values for left , right , top or bottom to position the button DIV where you want.

How do I overlay in bootstrap?

Just set the div in which you want the other div placed to position:relative; and then place the overlay div with position:absolute; and top , right , etc. where you need it.

How do I display a button over an image in HTML?

To add a button to an image, first, take a <div> element and use position: relative property to it. Set the width of the container and add an image with width: 100% so that the image covers the whole container. Now add a <button> with position: absolute to place it over the image.

How do you put a play button on a picture?

To add a play button overlay, upload your photo or drag n drop it to the editor. Next, click on the “Icons” tool located at the left sidebar of the editor. Search for the keyword 'play button' and choose from a wide range of icons for your image. After you're done, download the image in multiple file formats.


1 Answers

Stano answered the question for me!

"...yes the button can be positioned above the image tag, for example like this: http://jsfiddle.net/ubWuX"

HTML:

<div id="img_container">
    <img src="http://jsfiddle.net/img/initializing.png"/>
    <button class="button"> click here </button>
</div>

CSS:

#img_container {
    position:relative;
    display:inline-block;
    text-align:center;
    border:1px solid red;
}

.button {
    position:absolute;
    bottom:10px;
    right:10px;
    width:100px;
    height:30px;
}
like image 66
fat fantasma Avatar answered Oct 03 '22 03:10

fat fantasma