javascript - 如何在我的网站上模拟手机框架播放视频?

标签 javascript html css html5-video

我想在我的网站上显示视频,但我希望这些视频位于手机框架内,例如

enter image description here

我希望视频在白色手机框架之类的东西中播放。

希望我说得足够清楚。但是我不知道如何实际执行此操作。 谢谢

最佳答案

希望这对某人有帮助:

HTML:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<div class="smartphone">
  <div class="content">
    <iframe src="https://wpcoder.co.uk/links/mixkit-man-holding-neon-light-1238-large.mp4" style="width:100%;border:none;height:100%" />
  </div>
</div>

</body>
</html>

CSS:

/* The device with borders */
.smartphone {
  position: relative;
  width: 360px;
  height: 640px;
  margin: auto;
  border: 16px black solid;
  border-top-width: 60px;
  border-bottom-width: 60px;
  border-radius: 36px;
}

/* The horizontal line on the top of the device */
.smartphone:before {
  content: '';
  display: block;
  width: 60px;
  height: 5px;
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #333;
  border-radius: 10px;
}

/* The circle on the bottom of the device */
.smartphone:after {
  content: '';
  display: block;
  width: 35px;
  height: 35px;
  position: absolute;
  left: 50%;
  bottom: -65px;
  transform: translate(-50%, -50%);
  background: #333;
  border-radius: 50%;
}

/* The screen (or content) of the device */
.smartphone .content {
  width: 360px;
  height: 640px;
  background: white;
}

实例: https://codepen.io/neilbannet/pen/WNvqNLR

关于javascript - 如何在我的网站上模拟手机框架播放视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59265161/

相关文章:

JavaScript 验证错误

javascript - 单击获取边框时 react 图像

html - FusionChart AngularJS : Cannot display two separate charts "No Data to display"

javascript - 奇怪的 HTML 行为

javascript - 将 div 的大小调整为自动,然后在调整窗口大小时将其调整为彼此相同的高度?

javascript - 如果此代码运行则执行代码

javascript - 使用 jQuery CSS 设置一个 div 与另一个 div 具有相同的高度

java - 如何在 GUI 中查看 CSS/HTML?

javascript - 显示/隐藏 div 取决于 AngularJS 中默认值的下拉选择

html - 你如何覆盖 <DT> 背景颜色来模拟禁用?