请注意,本文编写于 2008 天前,最后修改于 1534 天前,其中某些信息可能已经过时。
之前曾经试过用B站的外链挂载视频,不过效果不太理想,就没有用下去。这次刚好看到了寒光博主的方法,感觉效果还不错,看来是可以省下点云存储的费用了(^__^) 。
效果
这里放上我们的花丸小天使~
食用方法
复制视频源代码
打开B站视频网页,如图找到嵌入代码后复制
<iframe src="//player.bilibili.com/player.html?aid=67792202&cid=117509299&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=67792202&cid=117509299&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
添加CSS
将以下代码添加到主题的自定义CSS里(控制台--外观--设置外观--开发者设置--自定义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
}
好了,大功告成~
版权属于:Dxoca's blog
原文链接:https://dxoca.cn/front/257.html
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
One comment
网络流行语融入自然,贴近年轻读者。