在网站播挂载放哔哩哔哩视频
很多时候,我们经常看到网站中挂着B站的视频,因为个人比较喜欢B站的播放样式,还有弹幕,就在网上找了一下,教程不是我写的,我就是觉得不错,分享一下,很好看。
效果
使用教程
给主题添加自定义样式:将以下代码添加到主题的自定义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站的番剧动漫没有这个代码)
<iframesrc="//player.bilibili.com/player.htmlaid=11932135&cid=19697229&page=1scrolling="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=11932135&cid=19697229&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
其他优酷,腾讯视频资源也是同样的原理,只需要将src=之后的连接修改一下,具体效果怎样还是自己去试一下吧。
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »