wordpress中嵌入B站视频自适应显示

第一段代码放在主题的css中的:

.smartideo { z-index: 0; text-align: center; background: #CCC; line-height: 0; text-indent: 0; }
.smartideo embed, .smartideo iframe { padding: 0; margin: 0; }
.smartideo .player { width: 100%; height: 500px; overflow: hidden; position: relative; }
.smartideo .player a.smartideo-play-link { display: block; width: 50px; height: 50px; text-decoration: none; border: 0; position: absolute; left: 50%; top: 50%; margin: -25px; }
.smartideo .player a.smartideo-play-link p { display: none; }
.smartideo .player .smartideo-play-button { width: 0; height: 0; border-top: 25px solid transparent; border-left: 50px solid #FFF; border-bottom: 25px solid transparent; }
.smartideo .tips { background: #f2f2f2; text-align: center; max-height: 32px; line-height: 32px; font-size: 12px; }
.smartideo .tips a { text-decoration: none; }
 
@media screen and (max-width:959px){
    .smartideo .player { height: 450px; }
}
@media screen and (max-width:767px){
    .smartideo .player { height: 400px; }
}
@media screen and (max-width:639px){
    .smartideo .player { height: 350px; }
}
@media screen and (max-width:479px){
    .smartideo .player { height: 250px; }
}

第二段代码嵌入到wordpress文章中:

<div class="smartideo">
 <div class="player">
  <iframe src="//player.bilibili.com/player.html?aid=243829823&amp;bvid=BV1Sv411i7KS&amp;cid=209606589&amp;page=1&amp;high_quality=1&amp;danmaku=0" width="100%" height="100%" frameborder="no" scrolling="no" allowfullscreen="allowfullscreen"> </iframe>
 </div>
</div>

把要分享的视频地址更换掉就可以了,大概就这么个意思。

主题测试文章,只做测试使用。发布者:fu4k,转转请注明出处:https://1991.run/579.html

(0)
fu4kfu4k
上一篇 15 4 月, 2021 2:12 上午
下一篇 1 5 月, 2021 3:01 下午

相关推荐

发表回复

登录后才能评论

publish; echo $getCount; ?>Posts queries seconds MBMem