新年新气象,于是最近想在文章内插入一些喜庆的视频,这不就在网上找到了如何文章内插入视频,下面也把方法分享给大家!
给主题添加自定义样式:将以下代码添加到主题的自定义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
}
复制以下视频源代码到文章中想显示的地方(自行更改代码中bvid=后面的视频BV号,可自行到b站中查询视频BV号。)
<iframe class="iframe_video" src="//player.bilibili.com/player.html?aid=586332404&bvid=BV1Sz4y1S7uB" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
大功告成:保存文章,回到网站,刷新整站打开文章就可以看到效果啦~