自定义CSS并引入123456789101112131415161718192021222324252627282930/*哔哩哔哩视频适配*/.video-bilibili { position: relative; width: 100%; height: 0; padding-bottom: 65%; margin: 3% auto; text-align: center;}.video-bilibili iframe { position: absolute; width: 100%; height: 100%; left: 0; top: 0;}.video-youtube { position: relative; padding-bottom: 56.25%; height: 0; margin: 3% auto;}.video-youtube iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}用法示例123456789101112<div class="video-bilibili"> <iframe src="https://player.bilibili.com/player.html?aid=412679216&&page=1&as_wide=1&high_quality=1&danmaku=0" scrolling="no" border="0" frameborder="no" framespacing="0" high_quality="1" danmaku="1" allowfullscreen="true" ></iframe></div>123<div class="video-youtube"><iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/76_6dy-lBlA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></div>效果展示电脑端展示手机端展示