给主题添加自定义样式:将以下代码添加到主题的自定义CSS里(Handsome主题在:控制台--外观--设置外观--开发者设置--自定义CSS,复制到框中即可,其他主题找到合适的位置放置)

/*视频挂载*/

.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
}

复制视频源代码:打开B站视频网页,如图找到嵌入代码然后复制(好像B站的番剧动漫没有这个代码)
QQ截图20190915201410.png
修改代码:复制嵌入代码到文章需要放置的位置。然后在给iframe 这个标签添加 class="iframe_video" 位置如下:

大功告成:保存文章,回到网站,刷新整站打开文章就可以看到效果啦~

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