所以我正在尝试制作一个 Youtube 画廊(也是响应式的),我的视频将在其中彼此相邻。我试图将它们放在一个容器中,并制作一个无序列表,但它仍然保持垂直。有什么想法吗?感谢所有的帮助!
这是我的CSS:
<style type="text/css">
.container {width: 200px;}
.container ul li {display: inline block;}
</style>
这是 HTML:
<div class="container">
<ul>
<li><iframe width="200" height="150" src="https://www.youtube.com/embed/kG_QhttG6jo" frameborder="0" allowfullscreen></iframe></li>
<li><iframe width="200" height="150" src="https://www.youtube.com/embed/kG_QhttG6jo" frameborder="0" allowfullscreen></iframe></li>
<li><iframe width="200" height="150" src="https://www.youtube.com/embed/kG_QhttG6jo" frameborder="0" allowfullscreen></iframe></li>
<li><iframe width="200" height="150" src="https://www.youtube.com/embed/kG_QhttG6jo" frameborder="0" allowfullscreen></iframe></li>
</ul>
</div>
最佳答案
您的容器宽度仅为 200 像素,因此视频被迫垂直堆叠。尝试将您的 CSS 更改为:
.container {
width: auto;
}
.container ul li {
display: inline-block;
}
关于html - 如何使 youtube 视频保持一致 (ul>li)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34363382/