使嵌入行为像 div 一样
我想添加一些 css 以使 标记看起来像
。目前,它添加了任意高度和宽度,这通常会导致类似于 iframe 的滚动框。有谁知道“嵌入重置”使其表现得像一个div?
编辑:实际上,我只需要弄清楚如何根据内部内容获取高度。这是我到目前为止所得到的:
embed {
width: 100%;
display:block;
margin: 0;
/* Below from Eric Meyer's Reset */
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
谢谢, 马特
I would like to add some css to make the <embed />
tag look like a <div>
. Currently it adds an arbitrary height and width that often lead to a scrolling box similar to an iframe.
Does anyone know an "embed reset" to make it behave like a div?
Edit: Really I just need to figure out how to get the height to be based on the inner content. Here's what I have so far:
embed {
width: 100%;
display:block;
margin: 0;
/* Below from Eric Meyer's Reset */
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
Thanks,
Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只是一个疯狂的猜测。 对你有用吗
? (这里是 display:block 的解释)。
注意 height 和 width 属性
embed
元素的数量必须是像素,而不是百分比,因此在这里没有多大帮助。Just a wild guess. Does
work for you? (Here's the explanation for display:block).
Note that the height and width attributes of
embed
elements must be pixels, not percentages, and thus aren't much helpful here.当您也设置
What happens when you style the
<object>
tag too?您可以将
width=100%;
和height=100%;
添加到标签本身。<嵌入 src="http://google.com" type="text/html" width=100%; height=100%;>
http://jsfiddle.net/jasongennaro/K8nCn/1 /
重要提示:只有在有足够的窗口空间容纳内容时,这才有效。 (拖动小提琴即可看到滚动条消失)
您可能已经知道这一点,但
embed
适用于视频和音频等交互式内容。 [1,2]我想说,通过
iframe
或其他方法更好地提供 Web 内容比如 php + cURL。You can add
width=100%;
andheight=100%;
to the tag itself.<embed src="http://google.com" type="text/html" width=100%; height=100%;>
http://jsfiddle.net/jasongennaro/K8nCn/1/
Important: this will only work if there is enough window space for the content. (drag the fiddle to see the scroll bars disappear)
You probably already know this but
embed
is intended for interactive content such as videos and audio. [1, 2]I would say serving Web content is better done through an
iframe
or some other method like php + cURL.