当前位置:首页 > Contributors > 正文内容

WordPress文章内容中插入外链视频,如何自适应屏幕宽度?

admin4年前 (2022-04-17)Contributors993

wordpress 视频如何自适应屏幕宽度?在wordpress里面插入这样一段代码:

<video controls preload="auto"  poster="视频封面地址" max width="100%" max height="100%" src="视频地址"></video>


WordPress文章中插入视频自适应页面大小代码

如果我们将一些网站的视频以iframe的形式直接贴在WordPress的博客或者网站当中的话,视频在页面的尺寸会非常的小,很不利于我们的观看。所以就想个办法将这个功能完善一下。

好了,不多说,直接上代码,记得将分享地址的代码简单修改一下。

<div class="smartideo">
<div class="player"><iframe src="//player.bilibili.com/player.html?aid=53452583&amp;cid=93503857&amp;page=1" width="100%" height="100%" frameborder="no" scrolling="no" allowfullscreen="allowfullscreen"> </iframe></div>
</div>

这里是需要给div定义类名,方便在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; }
}


扫描二维码推送至手机访问。

版权声明:本文由博赚恋吧资源站发布,如需转载请注明出处。

本文链接:https://432l.com/post/9700.html

标签: WordPress
分享给朋友:

相关文章

HostBIGGER - 1G容量cPanel面板免费PHP空间

HostBIGGER免费网站空间,1G容量,10G月流量,采用cPanel管理面板(有中文版),支持PHP5、CGI(Perl)、SSI、PYTHON,2个MySQL数据库,FTP、WEB方式上传管理文件。HostBIGGER免费空间免费提供1个二级域名,不支持绑定自己的域名。HostBIGGER明确声明没有网站语言限制,中文站肯定不会被K!HostBIGGER免费网站空间无广告。网址:http:...

420MB-提供5G可绑米CP面板免费PHP空间

420MB提供5G可绑米免费空间,支持PHP5、CGI。可绑定域名。网址:http://www.420mb.com。...

PurgeHosting - 支持FTP、PHP、CGI大小250M/1G的国外免费空间

PurgeHosting - 支持FTP、PHP、CGI的国外免费空间250M/1GPurgeHosting美国的一家虚拟主机服务商,为广大用户价格低廉的虚拟主机和代理主机,同时提供250M-1000M的免费虚拟主机。其提供的免费空间具有cPanel中文管理面板,ftp(3个ftp帐户)、web方式上传管理文件,支持PHP5、CGI,提供3个MySQL数据库,有免费二级域名,可以绑定1个域名、停放...

1000G.免费提供1000G全能免费空间

1000G.in免费全能空间申请,超大免费空间,注册即可开通。首先站长提醒:拿过来玩玩还行,可是要是真的作站,呵呵,等着哭吧功能:免费空间支持ASP + ACCESS + PHP5 + Zend3 + GD2 + Rewrite           配置:1000G网页空间资源:无限IIS...

见过最好的国外免费空间,速度快,功能强大!

这篇帖子来自免费吧会员460411234 的提供!下面是全文:前天申请的PurgeHosting.空间吧等了两天审核成功呵呵!不知道是我操作有问题还是怎么样等了两天空间刚开通就过来给坛友汇报情况空间打开速度很快功能很强大是目前我见过的最好免费空间啥也不说了申请空间地址演示地址:上图(图是此空间外链哦)看官们自己评论...

30G/50G流量,可绑米使用10年的免费PHP空间

- 30Gb of webspace- 50Gb of bandwidth a month- 5 Mailboxes- 5 Sub-domains- Easy web address http://YOU.websites4anyone.com- Use for your own domain if you have one- Online web page editor no software...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。