开发者

Where does the width of this iframe come from?

Another issue related to the Facebook "Like" iframe: I simply do not understand where its width comes from. Look at the following code

<html>
<body>
Test<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.google.com&amp;send=false&amp;layout=button_count&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>Test
</body>
</html>

which is a minimal demonstration of including Facebook's "Like" button in a page. You will notice that the words "Test" surrounding the button are spaced quite far apart. Inspector tools reveal that the width of the iframe is precisely 300px. However, browsing through the DOM tree of the iframe, I cannot find a single element or style that would cause the iframe to expand to that width. No CSS used by the page loaded within the iframe even mentions anything related to 300px.

This looks weird to me but is consistent across browsers.开发者_开发知识库 Ultimately, I would like the iframe to simply fit its contents of course (see my previous question), but for now, I'd be content to simply know why the heck it even expands to 300px width in the first place.


I have at last solved this mystery at least:

300px x 150px are the default iframe dimensions in Firefox, Chrome and maybe some other browsers. It's a shame that the inspector does not show that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜