惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

听得入迷空间

我买过什么主题 全站变灰 添加网页动态滚动进度条|滚动指示器 关于河南话学术研究待解决的问题|搬运笔记 静心诀、清心诀、冰心诀 阳光十六法则 光圈、感光度ISO、快门 喜迎72周年国庆|国旗知识 朝代歌 logo进化 机场 简单的书签导航页 简单的书签导航页 - 听得入迷空间 《竞选州长》 - 马克 · 吐温 安卓手机制作启动盘 - 听得入迷空间 logo进化 - 听得入迷空间 《星游记》全集新4K重置 - 听得入迷空间 解锁EdgeOne,免费CDN - 听得入迷空间 静心诀、清心诀、冰心诀 - 听得入迷空间 海绵宝宝1-13季分享 - 听得入迷空间 可商用免费字体-打包下载 - 听得入迷空间 Trae,简单可用的AI IDE - 听得入迷空间
b站iframe宽度自适应
听得入迷空间 · 2026-06-17 · via 听得入迷空间

技术教程 · 2026-06-17 · 1 分钟阅读

b站iframe插入视频大小是不能自适应的,所以用固定比例的方式使之适应网页宽度。

固定长宽比例为16/9,保持宽度100%。

/*b站iframe优化*/
.iframe_video{
        position:relative;
        height:0;
        padding-bottom:56.25%;
        overflow:hidden
}
 
.iframe_video embed,.iframe_video iframe,.iframe_video object{
        position:absolute;
        top:0;
        left:0;
        width:100%;
        height:100%
}

CSS是从MDUI复制过来的,原理就是保持长宽比例为16/9,使用的时候用<div class="iframe_video"> </div>套住

引用以上CSS然后:
 
<!--插入iframe视频的时候用这个div套住-->
<div class="iframe_video">
<iframe src="//player.bilibili.com/player.html?aid=626346337&bvid=BV16t4y1Q7Wr&cid=210274319&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" > </iframe>
</div>