Hanumendra
Hanumendra

Reputation: 319

wrapping swf inside anchor tag

I have added a swf file on my HTML page and wanted to wrap it up inside an anchor tag so that when someone clicks it, it goes to another page

<a href="http://www.spoiledagent.com/us/login_register.php" style="z-index:5">
<embed src="images/right_banners/300x250-lux.swf" width="300" height="250" style="z-index:1"> 
</embed>
</a>

I tried this, but it is not working, how can I do this?

Upvotes: 1

Views: 1028

Answers (1)

insertusernamehere
insertusernamehere

Reputation: 23580

Here's a solution that works in Chrome, Firefox, Safari on both MAC and PC as well as in Internet Explorer 9 and Internet Explorer 10 on PC.

For Firefox adding the attribute wmode="transparent" helped, for all other browsers a transparent div did the trick.

HTML

<a href="">
    <embed src="" width="300" height="250" wmode="transparent"></embed>
    <div></div>
</a>

CSS

a {
    position: relative;
}

a > embed {
    position: absolute;
    top: 0;
    left: 0;
}

a > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 250px;
    background: rgba(0, 0, 0, 0.01);
}

Demo

Try before buy

Upvotes: 6

Related Questions