如何并排放置两个iframe

use*_*680 2 html css iframe

我尝试了几个代码,比如这个:

<div class="box"><iframe src="https://embed.spotify.com/?uri=spotify:user:1290230929:playlist:6nTIVNGZfnZ4urUiwHIgpT" 
                         frameborder="0" 
                         scrolling="no" 
                         width="100%" 
                         height="512" 
                         align="left"> </iframe> </div>
<div class="box"><iframe src="https://embed.spotify.com/?uri=spotify:user:1285279066:playlist:56KI83cMiMTOocIdXq2R5j" 
                         frameborder="0" 
                         scrolling="no" 
                         width="100%" 
                         height="512" 
                         align="right">
    </iframe>
Run Code Online (Sandbox Code Playgroud)

如果有人可以为我解决这个问题,那么它并不起作用,谢谢.

Dan*_*har 7

干得好.在div中使用float这是在下次发布之前基本善用的搜索.

HTML:

<div class="box"><iframe src="https://embed.spotify.com/?uri=spotify:user:1290230929:playlist:6nTIVNGZfnZ4urUiwHIgpT" frameborder="0" scrolling="no" width="100%" height="512" align="left"> </iframe> </div>

<div class="box">    <iframe src="https://embed.spotify.com/?uri=spotify:user:1285279066:playlist:56KI83cMiMTOocIdXq2R5j" frameborder="0" scrolling="no" width="100%" height="512" align="right">
    </iframe>
Run Code Online (Sandbox Code Playgroud)

CSS:

.box{
    float:left;
    margin-right:20px;
}
.clear{
    clear:both;
}
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/E5WFT/


dis*_*ing 5

1.width="100%"从 iframe 中删除。

2.如果您希望它们完全并排,请在第二个 iframe 上更改align="right"为。align="left"

3.添加此 CSS:

.box { display:inline-block; }
Run Code Online (Sandbox Code Playgroud)

演示版


Roy*_*mir 1

问题在这里:

在此输入图像描述

为什么是width100%?为什么在div?(这样,他们就永远不会肩并肩了:-))

尝试这个 :

http://jsbin.com/hirirazu/3/edit

在此输入图像描述