- 拿到bilibili分享出来的地址后,在域名'bilibili.com'前面加入一个 i 字符,把链接输入到浏览器即可获得aid和cid
获取aid和cid方法:查看网页源代码,Ctrl + F
搜索aid=
、cid=
使用 aid 和 cid (替换掉:xxxxxxx)
src="//player.bilibili.com/player.html?aid=xxxxxxx&cid=xxxxxxx&page=1"
嵌入网页的最终格式
<iframe class="iframe_video" src="//player.bilibili.com/player.html?aid=764454887&cid=448055220&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
- 自定义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
}
- 演示