> It seems like there are only 4 methods to overlap 2 images using CSS?
I never counted, but there are indeed multiple ways, probably several
more than 4.
> There are two images, each with its own URL. Using CSS, there seems to
> be 2 ways to overlap them (the task is actually to put a "play button"
> image with size 50 x 50 on top of the bigger image which is a video
> thumbnail size 200 x 150).
Piece of cake, really.
> 4) use an image that has a background.
This one get my vote. One way to do it:
div {
background: #fff url(img1.png);
color: #000;
width: 200px;
height: 150px;
text-align: center;
}
img {
margin-top: 50px;
}
<div><img src="img2.png" width="50" height="50" alt="Play"></div>
> is it true that we cannot easily size the 2
> images and position them easily.
You cannot resize a background image, at least not at this time. Make
the containing div the same dimensions as the background image. If the
background isn't the size you need, resize it in a graphics editor first.
Positioning the foreground image is easy peasy.
> (for example, how do you position
> the play button on the video thumbnail?)
This is a case where absolute positioning might be useful, but you can
do it just as easily without, just using margin on the <img> or even
padding on the containing <div>

Signature
Berg
liketofindoutwhy - 23 Aug 2008 00:46 GMT
> This one get my vote. One way to do it:
>
[quoted text clipped - 11 lines]
>
> <div><img src="img2.png" width="50" height="50" alt="Play"></div>
i see... one reason this has problem is that if a link a wrapped
around the final result, IE won't take the whole thing as the link.
the play button is excluded from the link. some more info on
http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets/browse
_thread/thread/593db08fb89f1d55?hl=en#
Bergamot - 23 Aug 2008 04:02 GMT
>> <div><img src="img2.png" width="50" height="50" alt="Play"></div>
>
> one reason this has problem is that if a link a wrapped
> around the final result, IE won't take the whole thing as the link.
Sure it will, if you apply the right rules. You had the right idea in
your other post (with the span display:block), you just applied them
kind of backwards.
Put the <a> element in there and make it display:block. You might need
to add a couple more rules, but that should make the inline <a> fill the
parent div.

Signature
Berg
liketofindoutwhy - 24 Aug 2008 15:37 GMT
> >> <div><img src="img2.png" width="50" height="50" alt="Play"></div>
>
[quoted text clipped - 8 lines]
> to add a couple more rules, but that should make the inline <a> fill the
> parent div.
now, could it be an IE bug, as IE clearly shows the target link on the
status line of IE, but clicking that play button has no effect.
I don't quite see how right now it is backward... and put the <a>
element there? I thought it is already there.... you mean change <a>
to display:block? i thought in reality, <a> is not displayed but is
just to indicate a link. i am sorry, do you think you can give an
example?
Bergamot - 26 Aug 2008 23:41 GMT
>> >> <div><img src="img2.png" width="50" height="50" alt="Play"></div>
>>
[quoted text clipped - 5 lines]
> now, could it be an IE bug, as IE clearly shows the target link on the
> status line of IE, but clicking that play button has no effect.
IE has lots of bugs, among which is how it handles replaced elements
like <img>, and switching elements from inline to block.
> i thought in reality, <a> is not displayed but is
> just to indicate a link.
Not sure what you mean by that. <a> is an inline element, so it is
display:inline by default.
http://www.w3.org/TR/CSS21/visuren.html#display-prop
There is a lot more info on that page about inline and block elements,
among other things.
> i am sorry, do you think you can give an
> example?
Didn't somebody else already give you a working solution?

Signature
Berg