In article
<pogj12hkbn7hk4d6ro5rl1sl81n04drmmk@news.spartanic us.utvinternet.ie>,
Spartanicus <invalid@invalid.invalid> writes[color=blue]
>Alan Silver <alan-silver@nospam.thanx.invalid> wrote:
>[color=green]
>>
http://www.kidsinaction.org.uk/freds/freds.html
>>
>>Most of this is fairly simple to recreate in CSS, but the picture of the
>>candelabra has got me stuck. How do I place that so that it will stay in
>>the right position?[/color]
>
>Various ways to do this, one method: create a single image with
>transparency outside of the circle, place a span with a class or id in
>your markup somewhere in the content area, define the image as a
>background image to this span, give it the dimensions of the image,
>specify "position:absolute" and left:-[half the width of the image] and
>top:-[half the height of the image], wrap the content area in a div,
>specify "position:relative" for this div to make it the containing block
>for the absolutely positioned span.[/color]
Thanks for the reply, although I'm not clear that it answers my
question.
Maybe I didn't make the point clear enough, but the specific problem I
was facing with this issue was that the left margin will *not* be sized
in pixels, it will be sized in either % or em. To get the left position
of the image, you need to take the width of the left margin, then
subtract half the width of the image. That means evaluating a
calculation with one term in % or em and the other in pixels.
AFAIK CSS
doesn't allow this. Maybe your answer does address this problem, in
which case I didn't understand what you were suggesting. If so, please
could you post some code so I can see what you meant?
I did have a thought over the weekend, but I haven't had chance to try
it yet. I wondered about having two divs, each half the width of the
image, and placing them either side of the border between the left
margin and the rest of the content. One could have the left position set
and the other have the right position set. I would then set the
background image to be the image, offset so that the appropriate bit
shows. Bit convoluted, but I think it might work.
Any comments? Thanks for the reply
--
Alan Silver
(anything added below this line is nothing to do with me)