无法增加视频元素的宽度

时间:2014-04-29 22:48:14

标签: javascript jquery html css video

所以我有这样的案例

enter image description here

如您所见,视频未填充元素的整个宽度。

这就是我的html的样子 -

<div class="webcam"/>
    <div class="control-container">
</div>

视频元素是通过使用javascript网络摄像头库创建的 -

https://github.com/jhuckaby/webcamjs

var that = this;
Webcam.set({
    width: this.options.width,
    height: that.options.height,
    image_format: 'jpeg',
    jpeg_quality: 100,
    force_flash: false
});
Webcam.attach('.webcam');

这就是视频元素的样子

enter image description here

现在,宽度和高度分别为562和344,这也是包含元素的宽度和高度。我试图让它们变得更大,但所有发生的事情都是白色空间变大,而不是真正的实时观看者。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

尝试使用此代码

.webcam {
  width: 100%    !important;
  height: auto   !important;
}