如何将视频放在一行中

时间:2017-04-20 16:20:45

标签: html css

我正在尝试将所有视频放在一行而不是多行。



<div class="t">
   <ul>
   
  <li>somewhere I belong</li>
  <iframe  src="https://www.youtube.com/embed/zsCD5XCu6CM" frameborder="0" allowfullscreen></iframe>
  <li>Castle of glass</li>
  <iframe  src="https://www.youtube.com/embed/ScNNfyq3d_w" frameborder="0" allowfullscreen></iframe>
  
   </ul>
   </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

  1. 将每个<iframe>放入<li>
  2. 然后将display:table添加到<div class='t'>
  3. 接下来,将display:table-row添加到<ul>
  4. 最后一步是为每个display:table-cell添加<li>
      
        
    1. 忘记将display:block添加到每个iframe
    2.   
  5. .t {
      display: table;
      width: 100%;
      height: auto;
    }
    
    ul {
      display: table-row
    }
    
    li {
      display: table-cell
    }
    
    iframe {
      display: block;
    }
    <div class="t">
      <ul>
    
        <li>Somewhere I Belong
          <iframe src="https://www.youtube.com/embed/zsCD5XCu6CM" frameborder="0" allowfullscreen></iframe>
        </li>
    
        <li>Castle of Glass
          <iframe src="https://www.youtube.com/embed/ScNNfyq3d_w" frameborder="0" allowfullscreen></iframe>
        </li>
      </ul>
    </div>