我正在为我的网站制作一个抽搐的页面,我需要有关如何制作它的帮助,所以一边有一个twitch.tv播放器,另一边有twitch.tv聊天。我试过这个:
<div align="left">
<object type="application/x-shockwave-flash" height="500" width="900" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=clodbegamingnetwork" bgcolor="#000000">
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />
<param name="flashvars" value="hostname=www.twitch.tv&channel=clodbegamingnetwork&auto_play=true&start_volume=25" />
</object>
<div align="right">
<iframe frameborder="0" scrolling="no" src="http://twitch.tv/clodbegamingnetwork/chat?popout=" height="500" width="350">
</iframe>
</div>
但它不起作用。它这样做:
(我缩小了)
所以有人为我解决这个问题。我似乎无法弄清楚这是如何起作用的。
我希望看到allignment的示例(忽略抽搐球员底部的标题): http://prntscr.com/48xjj2
谢谢!
答案 0 :(得分:7)
object
和iframe
元素都定位为block
,这意味着它们是唯一使用“行”中整个空格的元素。为了允许两个元素并排,您可以将object
包裹在div
中然后执行:
#object-div {
float: left;
}
iframe {
float: right;
}
通过这样做,两个元素将共享同一行。您还可以通过执行以下操作将这些block
元素转换为inline
元素:
#object-div, iframe {
display: inline-block;
}
答案 1 :(得分:1)
<iframe style="width: 620px; height: 378px;" scrolling="no" frameborder="0" src="twitch url here/embed"></iframe><iframe style="width: 350px; height: 379px;" scrolling="no" frameborder="0" src="twitch url here/chat?popout="></iframe>
<center>
<a href="twitch url here?tt_medium=live_embed&tt_content=text_link" style="padding: 2px 0px 4px; width: 345px; font-size: 10px; font-weight: normal; text-decoration: underline; display: block;">Watch live video from (twitch user name here) on www.twitch.tv</a>
</center>
<iframe style="width: 620px; height: 378px;" scrolling="no" frameborder="0" src="twitch url here/embed"></iframe><iframe style="width: 350px; height: 379px;" scrolling="no" frameborder="0" src="twitch url here/chat?popout="></iframe>
<a href="twitch url here?tt_medium=live_embed&tt_content=text_link" style="padding: 2px 0px 4px; width: 345px; font-size: 10px; font-weight: normal; text-decoration: underline; display: block;">Watch live video from (twitch user name here) on www.twitch.tv</a>
答案 2 :(得分:1)
我是根据你的答案做到的,并让这个工作! 我的代码如下......
CSS
#stream { width: 75%; float: left; }
#chat { width: 25%; float: right }
HTML
<section align="center">
<h1>My LiveStream</h1>
</section>
<section>
<div class="stream" align="center">
<object type="application/x-shockwave-flash" height="500" width="900" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=clodbegamingnetwork"
bgcolor="#000000">
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />
<param name="flashvars" value="hostname=www.twitch.tv&channel=clodbegamingnetwork&auto_play=true&start_volume=25" />
</object>
<iframe frameborder="0" scrolling="no" src="http://twitch.tv/clodbegamingnetwork/chat?popout=" height="500" width="350">
</iframe>
</div>
</section>