【问题标题】:Embedded Youtube videos float to the right when viewed on phone在手机上观看时,嵌入的 Youtube 视频会向右浮动
【发布时间】:2016-10-20 09:29:40
【问题描述】:

我正在制作一个响应式网站,上面有一些 Youtube 视频。当我以 > 479 像素的分辨率查看我的网站时,视频会停留在中间,但是当我在手机屏幕分辨率上查看或将浏览器缩小到

这是我的代码:

	
	.youtube{
	text-align: center;
   
	}
<p class="youtube">
			<iframe width="560" height="340" src="https://www.youtube.com/embed/Ubl3r5mGRtg" frameborder="0" allowfullscreen></iframe></br>

			<iframe width="560" height="340" src="https://www.youtube.com/embed/xgr38LWUf7w" frameborder="0" allowfullscreen></iframe></br>
				<iframe width="560" height="340" src="https://www.youtube.com/embed/ylT54zdmGCk" frameborder="0" allowfullscreen></iframe>
   </p>

【问题讨论】:

    标签: html css youtube alignment center


    【解决方案1】:

    您可以添加到您的 CSS:

    iframe { max-width: 100%; }
    

    也许可以通过一些媒体查询来修复高度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-12
      • 1970-01-01
      • 2019-08-17
      相关资源
      最近更新 更多