
有可能吗?如果是的话,你能告诉我怎么样吗?
body { margin: 0;}.container { height: 100vh; position: relative;}.container .vIDeo { position: absolute; height: 50vh; wIDth: 100%;}.container .vIDeo vIDeo { position: absolute; top: 0; left: 0; height: 50vh; wIDth: 100%;} <div > <div > <vIDeo muted autoplay loop> <source src="http://res.cloudinary.com/dlm2jcfic/vIDeo/upload/v1465860427/343732582_johq2x.mp4" type="vIDeo/mp4"> </vIDeo> </div></div>解决方法 视频通常使用16:9的AR(宽高比)进行编码(16宽度到9高度).
>将视频元素设置为:
position: absolute; top: 0; left: 0; height: auto; wIDth: 100%;
>这应该使它能够伸展它的最大长度
>然后将其应用于容器:
position: relative; height: 0; wIDth: 100%; padding-bottom:56.25%;
>这将自行崩溃,同时扩展.奇怪的底部值将像ceran包裹在一盘食物上.这种风格的组合反应灵敏,非常好established.
SNIPPET
body { margin: 0;}.container { height: 100vh; position: relative;}.container .vIDeo { position: absolute; height: 0; wIDth: 100%; padding-bottom:56.25%;}.container .vIDeo vIDeo { position: absolute; top: 0; left: 0; height: auto; wIDth: 100%;} <div > <div > <vIDeo muted autoplay loop> <source src="http://res.cloudinary.com/dlm2jcfic/vIDeo/upload/v1465860427/343732582_johq2x.mp4" type="vIDeo/mp4"> </vIDeo> </div></div>总结
以上是内存溢出为你收集整理的HTML视频不占用100%的宽度全部内容,希望文章能够帮你解决HTML视频不占用100%的宽度所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)