I have div that contains an image, I need to place a button inside the image to around the top right corner of the image, when I do this
#button_id{
position: relative;
left: 270px;
top: 30px;
}
What this is doing is making the button image be placed somewhere else, it moves the image left to the right and down, but the now the button is click-able in bar from where it was originally placed to the far right of the div. When I try this
#button_id{
position: relative;
float: right; padding: 0px -40px -15px;
}
it moves the button to the right but it won't move it down.
Note: the button is inside the div, without the css it is placed on top of the image in the center
Take a look this example below: an image with previous and next button over it.
CSS===========================================
JScript======================= Ask and i will be discussed how you work with the next and previous thing.despite that this is a working example.
You should give the div containing the image a
position:relative
and your button that is contained within that div aposition:absolute
. That will position the button relative to the container div.If you don't have an specific reason to be using an img tag for this I would use a div structure like this:
To get the button to position correctly you are going to want to set the div position to "relative" and the button position to "absolute". This means the absolute position of the button will be based on the top left of the wrapping div.
An example of this css would be:
The above CSS will put your button in the top right with 5px of space between it and the corner of the div.