使用iframe作为链接? [英] Use iframe as a link?
问题描述
我正在使用iframe,并且在iframe中正在加载动态图像.我想使用该图像作为相应文章的链接.实际上,这是一个新闻网站.
I am using an iframe and in the iframe I am loading a dynamic image. I want to use that image as a link to the respective article. Actually this is a news site.
我已经使用了很多东西,例如:
I already have used many stuffs like:
<a href="whatever.."><iframe src="dynamic url"></iframe></a>
可以与IE一起使用,但不能与safari和FF一起使用.
does work with IE but not with safari and FF.
和
诸如
div.iframe-link {
position: relative;
}
a.iframe-link1 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
代码:
<div class="iframe-link">
<iframe src="file" width="90px" height="60px" frameborder="0" scrolling="no"
marginheight="0" marginwidth="0" allowtransparency="true" noscaling="true">
</iframe>
<a href="url" target="_top" class="iframe-link1"></a>
</div>
在FF和Safari中工作,而在IE7,8中工作.
worked in FF and Safari not in IE7,8.
所以任何人都可以建议该怎么做.
SO can anybody suggest what to do..
任何帮助将不胜感激.
iframe正在加载图片的动态地址,例如::::
The Iframe is loading a dynamic address of image like::::
<div class="news_img01">
<div onclick="window.open('URL','_self')" style="cursor: pointer;"><br>
<iframe scrolling="no" height="60px" frameborder="0" width="90px" noscaling="true" allowtransparency="true" marginwidth="0" marginheight="0" src="thumbnails/1188.gif">
</iframe>
</div>
</div>
所以我不能在其中添加标签,但已经在其中包装了标签.它适用于IE,但不适用于FF,Safari等其他应用.
so i cant add tag inside but already wrapped tag inside . it worked for IE but not for others like FF, Safari..
推荐答案
根据您先前的评论,您正在使用iframe来将大小未知的图像裁剪为60 x 90像素的框.为此,请使用a
标记上的overflow:hidden
css属性,该属性将切掉不适合边框的任何内容.
According to your earlier comments, you were using the iframe in order to crop an image of unknown size to a 60 by 90 pixel box. To do this, use the overflow:hidden
css attribute on the a
tag, which slices off any content not fitting within the border-box.
<div class="news_img01">
<a href="URL"
style="display: block; width:90px; height:60px; overflow:hidden;">
<img src="thumbnails/1188.gif" />
</a>
</div>
这篇关于使用iframe作为链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!