当前位置:网站首页>1px problem of mobile terminal
1px problem of mobile terminal
2022-07-03 13:55:00 【pzy_ six hundred and sixty-six】
problem
css Minimum support only 1px size , Insufficient 1px So 1px Show , So at the mobile end , according to UI Design draft , When adapting to various screen resolutions , Width and height at this peak , There will be a feeling that the actual result is coarser than the design draft .
Often embodied as : Multiple design drawings designed 1px Border , When zooming out on your phone , because css At least, only display 1px size , The result is that the border is too thick .
Solution
adopt transform: scale() The zoom
unilateral
Such as : Under the frame
.div::after {
content: '';
box-sizing: border-box;
position: absolute;
z-index: 1;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
border-bottom: 1px solid #bfbfbf;
transform: scaleY(1/2);
transform-origin: left bottom;
}
If you need to add other borders , It can be used before Pseudo elements plus , Such as adding a right border :
.div::before {
content: '';
box-sizing: border-box;
position: absolute;
z-index: 1;
right: 0;
bottom: 0;
width: 2px;
height: 100%;
border-right: 1px solid #bfbfbf;
transform: scaleX(1/2);
transform-origin: right bottom;
}
All sides
In this way, you can add border fillets :
.div::after {
content: '';
box-sizing: border-box;
position: absolute;
z-index: 1;
left: 0;
top: 0;
width: 300%;
height: 300%;
border: 1.5px solid #bfbfbf;
transform: scale(1/1.5/2);
transform-origin: left top;
border-radius: 6px;
}
Be careful
- Give the goal first div Element add non static Of position attribute , Because the above methods are implemented by using pseudo element location
- Concrete scale The scaling depends on how many times the size of the design drawing you are 1px, For example, a double graph (750px) Under size , The scale is 1/2( On the blackboard :scale Zoom scale and dpr irrelevant )
- The regular code on the Internet will have the problem that the borders of individual Android models are not displayed , My own code has done all kinds of compatibility processing : Unilateral solutions give pseudo elements 1px The height or width of the content area , Add a border to it 2px; All sides are based on 1.5px Border width to zoom .
Reference resources
1px Pixel problem ( One ): The real reason
边栏推荐
- Failure of vector insertion element iterator in STL
- windos 创建cordova 提示 因为在此系统上禁止运行脚本
- 3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
- 核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
- Golang — template
- 金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
- Unity EmbeddedBrowser浏览器插件事件通讯
- Brief analysis of tensorboard visual processing cases
- When updating mysql, the condition is a query
- Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
猜你喜欢
Screenshot of the operation steps of upload labs level 4-level 9
MySQL 数据处理值增删改
Qt学习17 对话框及其类型
When updating mysql, the condition is a query
Libuv Library - Design Overview (Chinese version)
Go: send the get request and parse the return JSON (go1.16.4)
Go language unit test 3: go language uses gocovey library to do unit test
Qt学习25 布局管理器(四)
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market
随机推荐
JVM系列——概述,程序计数器day1-1
KEIL5出现中文字体乱码的解决方法
RichView TRVStyle ListStyle 列表样式(项目符号编号)
Field problems in MySQL
双向链表(我们只需要关注插入和删除函数)
Richview trvstyle liststyle list style (bullet number)
Halcon combined with C # to detect surface defects -- Halcon routine autobahn
The solution of Chinese font garbled code in keil5
[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]
Comprehensive case of MySQL data addition, deletion, modification and query
RocksDB LRUCache
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
Flutter动态化 | Fair 2.5.0 新版本特性
How to promote the progress of project collaboration | community essay solicitation
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
GoLand 2021.2 configure go (go1.17.6)
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
Implementation of Muduo accept connection, disconnection and sending data
全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
Unity Render Streaming通过Js与Unity自定义通讯