方法

/*视频挂载*/

.iframe_video {
    position: relative;
    width: 100%;
}

@media only screen and (max-width: 767px) {
    .iframe_video {
        height: 15em;
    }
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
    .iframe_video {
        height: 20em;
    }
}

@media only screen and (min-width: 992px) and (max-width: 1199px) {
    .iframe_video {
        height: 30em;
    }
}

@media only screen and (min-width: 1200px) {
    .iframe_video {
        height: 40em;
    }
}

.iframe_cross {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%
}

.iframe_cross iframe {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0
}

打开bilibili随便一个视频,好像动漫番剧不行,然后如图下面到嵌入代码嵌入B站视频.jpg

  • 复制下来的b站嵌入代码
<iframe src="//player.bilibili.com/player.html?aid=412935552&bvid=BV1FV411d7u7&cid=186803402&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
  • 修改一下复制嵌入代码到文章需要放置的位置。然后在给iframe 这个标签添加 class="iframe_video"
  • 修改后的代码:
<iframe class="iframe_video" src="//player.bilibili.com/player.html?aid=412935552&bvid=BV1FV411d7u7&cid=186803402&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

保存,打开网站看看!

最后修改:2020 年 06 月 08 日 04 : 25 PM
如果觉得我的文章对你有用,请随意赞赏