CSS是一种用来控制网页样式的语言,除了能够设置文字、图片等元素的样式外,还可以通过设置样式表来控制视频的样式。接下来我们就来介绍如何在CSS中设置视频教程的方法。首先,我们需要在HTML中使用vid
<video src="video.mp4"></video>
video { width: 100%; height: auto; }
video { width: 100%; height: 0; padding-bottom: 56.25%; /* 16:9的宽高比 */ }
/* 控制条 */ video::-webkit-media-controls { display: none !important; } /* 播放按钮 */ .video-play-button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, 0.4); color: #fff; line-height: 64px; text-align: center; cursor: pointer; }
@media screen and (max-width: 768px) { video { height: 240px; } .video-play-button { width: 48px; height: 48px; line-height: 48px; } }
粉丝
0
关注
0
收藏
0