- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在迈出学习编码的第一步。我已经在 Internet 上学习了一些类(class),现在我决定在自己构建 Wordpress 子主题的同时继续从经验中学习。
问题是我在一个模板中使用了一个 vimeo iframe。
iframe {
width:70%;
}
<iframe src="https://player.vimeo.com/video/41845276" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
我喜欢它,它工作正常,但我希望可以按比例调整它的大小并且周围没有很多黑色空间。尝试总是拥有这样的东西
不是这样的:
例如,我在我的 iPhone 上看到它是这样的,但效果不是很好,因为它几乎占据了我的整个屏幕:
你有什么建议吗?
非常感谢您的帮助
最佳答案
试试这个,如果您知道视频的真实比例,例如 16:9
或 4:3
,您可以使用视口(viewport)单位来设置大小。像这样:
16 : 9
70vw x 39vw
iframe {
display:block;
margin:0 auto;
width:70vw;
height:39vw;
}
<iframe src="https://player.vimeo.com/video/41845276" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
关于html - 制作成比例的vimeo iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39748896/
以下问题:我有一个包含很多 div 的滚动页面。每个 div 都有一个 bg-image 和另一个带有文本的 div。 blabla anothe
在 CSS 中是否可以按比例设置一个属性到另一个属性?我知道我可以用 java-script 做到这一点,但如果用 CSS 可以做到这一点,我会很高兴。 例如:width:10 % height; 如
我正在尝试设置一个看起来像这样的约束(红色父 View 中的 subview 白色): 我将如何在界面生成器中执行此操作(最好),如果不可能则编写代码,但我应该将什么作为宽度来让 IB 满意? 我试过
我试图将 View 元素放置在 UIImageView 中,然后对 UIImageView 的宽度进行动画处理以填充 super View 。我正在使用自动布局约束来定位 View 并为其设置动画。在
我是一名优秀的程序员,十分优秀!