html - 如何用CSS改变Html视频的大小

标签 html css html5-video

我想知道如何仅使用 css 更改 html 视频的宽度/高度。我是否需要做一些与人们通常使用 CSS 调整对象大小不同的事情,还是我可以按正常方式进行。

最佳答案

<!DOCTYPE html> 
<html> 
<body> 

<video width="320" height="240"controls>
  <source src="mov_bbb.mp4" type="video/mp4">
  <source src="mov_bbb.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>

<p>
Video courtesy of 
<a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.
</p>

</body> 
</html>

#vid {
    width: 500px;
    height: 500px;
}
<!DOCTYPE html> 
    <html> 
    <body> 

    <video controls id="vid">
      <source src="mov_bbb.mp4" type="video/mp4">
      <source src="mov_bbb.ogg" type="video/ogg">
      Your browser does not support HTML5 video.
    </video>

    <p>
    Video courtesy of 
    <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.
    </p>

    </body> 
    </html>

关于html - 如何用CSS改变Html视频的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56120824/

相关文章:

html - safari html5 视频加载问题

html5-video - 如何修复 412(前提条件失败)错误 HTML5 视频标签

html - 自定义格式数字 TypeScript Angular 5

javascript - 无法在 Google map 中显示 KML 属性数据

html - CSS 在移动设备上将 Flex 布局旋转 90 度

css - 修复 Chrome 中视频重叠的问题

php - Joomla 3 : Hide Class on Home Page

c# - 类似于 .Net/C# 的 Jericho HTML 的解析器

javascript - 单击按钮时添加或清除 localStorage 并在 html 中显示值

html - <输入类型 ="text"> 不允许调整大小