I want background image on a button to appear at the top right corner.
I successfully used background-position: bottom top 100px
to move the image to the top, but I have been unsuccessful moving the image to the right.
Is there something similar to background-position: bottom top 100px, right 900px
that might help produce the desired results?
#AddNewMeetingButton {
position: absolute;
top: 0;
text-align: center;
background-image: url(Images/add_icon_48x48.png);
background-position: bottom top 100px, right 800px;
background-repeat: no-repeat;
height: 190px;
width: 915px;
background-color: transparent;
outline: none;
border: none;
z-index: 2;
}
Give it a shot. Essentially, background-position: 90% 50% will make the right edge of the background image line up 10% away from the right edge of the container. Create a div containing the image. Explicitly set the position of the containing element position: relative if not already set.
You could try: background-position: right top; If you need a margin add it to the image. Almost, but margin won't affect a background image.
Try using float: right; and a new div for the top so that the image will stay on top.
Something like this
background-image: url(http://i.stack.imgur.com/cW9aK.png);
background-repeat: no-repeat;
background-size: 48px 48px;
background-position: right 10px top 10px;
JSfiddle Demo
MDN Reference
background-position:<position>
where:
<position>
is one to four values representing a 2D position regarding the edges of the element's box. Relative or absolute offsets can be given. Note that the position can be set outside of the element's box.
So:
background-position: right 10px top 10px;
puts the image at the top / right but 10px away from the right edge and 10px from the top edge
You could try:
background-position: right top;
If you need a margin add it to the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With