所以我有这样的案例
如您所见,视频并未填满元素的整个宽度。
这是我的 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');
这是视频元素的样子
现在宽高分别是562和344,也是包含元素的宽高。我试图让这些变大,但结果是空白变大,而不是实际的实时查看器。
我该怎么办?
最佳答案
尝试使用这段代码
.webcam {
width: 100% !important;
height: auto !important;
}
关于javascript - 无法增加视频元素宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23376653/