gpt4 book ai didi

html - iFrame 没有并排响应(当屏幕变小时内联 block 中断)

转载 作者:太空宇宙 更新时间:2023-11-04 06:42:59 26 4
gpt4 key购买 nike

我正在使用两个 iframe,并且我已经从我的代码中删除了所有 paddingmargin。当屏幕变小时,它们都坏了(它们不再对齐),我仍然找不到原因。

body{
background:#0d3852;
margin:0;
padding:0;
}
iframe{
background:#ccc;
border:0;
margin:0;
padding:0;
}
.box {
margin:0;
padding:0;
display:inline-block;
width:49.77%;
}
<!DOCTYPE html>
<html>
<body>
<div class="box">
<iframe src="https://open.spotify.com/embed/user/radomer/playlist/4S4lTBokwOjIvEHkz3klTj" width="100%" height="500" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
</div>
<div class="box">
<iframe src="https://open.spotify.com/embed/user/radomer/playlist/4S4lTBokwOjIvEHkz3klTj" width="100%" height="500" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
</div>
</body>
</html

最佳答案

使用display:flex;代替display:inline-block;

body {
background: #0d3852;
margin: 0;
padding: 0;
}

iframe {
background: #ccc;
border: 0;
margin: 0;
padding: 0;
}

.box {
margin: 0;
padding: 0;
display: flex;
width: 49.77%;
}
<!DOCTYPE html>
<html>

<body>
<div class="box">
<iframe src="https://open.spotify.com/embed/user/radomer/playlist/4S4lTBokwOjIvEHkz3klTj" width="100%" height="500" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
</div>
<div class="box">
<iframe src="https://open.spotify.com/embed/user/radomer/playlist/4S4lTBokwOjIvEHkz3klTj" width="100%" height="500" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
</div>
</body>
</html

关于html - iFrame 没有并排响应(当屏幕变小时内联 block 中断),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53519711/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com