如何让youtube视频保持一致(ul> li)?

时间:2015-12-18 20:21:42

标签: html css

所以我试图制作一个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>

1 个答案:

答案 0 :(得分:1)

您的容器宽度仅为200像素,因此视频被迫垂直堆叠。尝试将CS​​S更改为:

.container {
  width: auto;
}

.container ul li {
  display: inline-block;
}
相关问题