Forum Moderators: not2easy
E.G:
--------------
¦.................¦
¦...........img..¦
¦.................¦
¦.................¦
¦.................¦
--------------
(Dots denote space)
Where the container is flexible width. And where there are no additional tags used purely to achieve this objective.
[ [ <percentage> ¦ <length> ¦ left ¦ center ¦ right ] [ <percentage> ¦ <length> ¦ top ¦ center ¦ bottom ]? ] ¦ [ [ left ¦ center ¦ right ] ¦¦ [ top ¦ center ¦ bottom ] ] ¦ inherit
Unfortunately, you can't get a fixed amount of space between the right of the image and the right edge of the container. The closest you can get would be to use percentages, which is unfortunate since you *can* set a fixed amount of space between the left (and top) of the image and the left (and top) edge of the container.
However, you might be able to get around this shortcoming by adding one more container element and adding padding to the outer container:
+-----------------------+
¦+------------+.........¦
¦¦............¦.padding.¦
¦¦.........img¦.........¦
¦¦............¦.........¦
¦+------------+.........¦
+-----------------------+
This may not work for you if you need other elements (text, etc.) to extend all the way to the right edge of the outer element.
I was trying to avoid having to use javascript to get transparency working in =<ie6. However I think I will have to do that.
Although it is annoying that you can position a bg image left numerically but not right numerically. I think that is a 'gap' in CSS that needs to be filled.
I don't know how it would be expressed. I guess, background-position-right: 20px; background-position-bottom: 20px; for example?
top: 0, left: 0
.....+--------+
.....¦xox!~;o!¦
.....¦xox!~;o!¦
.....¦........¦
.....+--------+
top: 0, left: -2px
.....+--------+
.....¦x!~;o!..¦
.....¦x!~;o!..¦
.....¦........¦
.....+--------+
[edited by: Fotiman at 2:28 pm (utc) on Aug. 14, 2008]
Anyways - can't you simply put:
background-image: url(path) -#px -#px top right no-repeat;
I haven't messed with background images too much like this - but it seems logical that that would work unless there is some bug.
The div to contain the image is absolutely positioned with a set width and height but it just expands horizontally 100% and vertically only up until the content I stick in it ends...
WDF
background-image: url(path) -#px -#px top right no-repeat;
If you couldn't get the background color and absolute positioning to work, then it's probably a problem with your selector (that is, it probably doesn't match the actual element on your page).