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

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
S
SegmentFault 最新的问题
T
Tailwind CSS Blog
The Hacker News
The Hacker News
GbyAI
GbyAI
P
Palo Alto Networks Blog
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Cyberwarzone
Cyberwarzone
H
Help Net Security
S
Securelist
月光博客
月光博客
博客园 - 【当耐特】
T
Threatpost
T
Tenable Blog
G
GRAHAM CLULEY
博客园 - 司徒正美
I
Intezer
MyScale Blog
MyScale Blog
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
The GitHub Blog
The GitHub Blog
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
Google DeepMind News
Google DeepMind News
C
Cybersecurity and Infrastructure Security Agency CISA
罗磊的独立博客
腾讯CDC
P
Privacy International News Feed
博客园_首页
The Cloudflare Blog
Cisco Talos Blog
Cisco Talos Blog
A
About on SuperTechFans
V
Vulnerabilities – Threatpost
A
Arctic Wolf
B
Blog RSS Feed
Recorded Future
Recorded Future
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
S
Security Affairs
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog

博客园 - ^Mao^

不同缩放下适配 vxe-table 3D饼图 openlayer实现给线的附近添加点,点支持移动 element-plus el-select html导出pdf openlayers增加移动功能 部分页面统计用户访问时长 openlayers基本使用(街景+标注+绘制) 使用openlayer绘制街景地图 正则表达式--取对应表达式的值 vue2实现el-table-column多级效果 echarts-雷达图 echarts--地图 散点图效果 echarts散点图区域设置 vant 的vant-uploader组件问题 Threejs学习 Echarts-普通地图和3D地图实现 test
适配
^Mao^ · 2025-11-08 · via 博客园 - ^Mao^

前端代码适配层面

  • 使用 Viewport 适配:在网页头部引入代码,其中width=device-width表示将 viewport 的宽度设置为设备的宽度,initial-scale=1.0表示初始缩放比例为 1.0,不进行缩放,user-scalable=no表示用户不可以通过手动缩放页面,这样可以避免屏幕缩放对页面布局的影响。
  • 使用媒体查询:通过媒体查询针对不同屏幕尺寸或页面缩放程度来确定不同的样式。例如,根据便携电脑缩放 150% 时的网页可见宽度作为依据,设置不同的 CSS 样式,如@media all and (-webkit - min - device - pixel - ratio: 1.41) and (-webkit - max - device - pixel - ratio: 1.6), (min - resolution: 1.41dppx) and (max - resolution: 1.6dppx) {body {font - size: 10px;}},来调整网页元素的大小和布局。
  • JavaScript 代码适配:可以在网页尾部的前加入以下 JavaScript 代码,根据屏幕像素比自动设置网页的 zoom 缩放比例。
<script>
const t = window.devicePixelRatio;
let zoom = 1;
if (t!== 1) {
zoom = (1 / t) * zoom;
}
document.body.style.zoom = zoom;
</script>