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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
S
Secure Thoughts
S
Security @ Cisco Blogs
S
Security Affairs
Forbes - Security
Forbes - Security
W
WeLiveSecurity
H
Hacker News: Front Page
T
Threatpost
Google Online Security Blog
Google Online Security Blog
S
Schneier on Security
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - Franky
腾讯CDC
IT之家
IT之家
博客园 - 聂微东
L
LINUX DO - 最新话题
罗磊的独立博客
Hacker News - Newest:
Hacker News - Newest: "LLM"
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cisco Talos Blog
Cisco Talos Blog
S
SegmentFault 最新的问题
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
美团技术团队
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
AI
AI
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Jina AI
Jina AI
Help Net Security
Help Net Security
N
News | PayPal Newsroom
月光博客
月光博客
Spread Privacy
Spread Privacy
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
News and Events Feed by Topic

博客园 - ^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>