当前位置:网站首页>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
边栏推荐
- Qt学习18 登录对话框实例分析
- Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
- Screenshot of the operation steps of upload labs level 4-level 9
- Replace the GPU card number when pytorch loads the historical model, map_ Location settings
- 使用vscode查看Hex或UTF-8编码
- Qt学习19 Qt 中的标准对话框(上)
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
- Use vscode to view hex or UTF-8 codes
- Several common optimization methods matlab principle and depth analysis
猜你喜欢

Flutter动态化 | Fair 2.5.0 新版本特性

Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware

使用Tensorflow进行完整的深度神经网络CNN训练完成图片识别案例2

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 新版本特性

Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.

Libuv Library - Design Overview (Chinese version)

8 Queen question
![[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered

Golang - command line tool Cobra
随机推荐
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
Unity EmbeddedBrowser浏览器插件事件通讯
GoLand 2021.2 configure go (go1.17.6)
Flutter dynamic | fair 2.5.0 new version features
实现CNN图像的识别和训练通过tensorflow框架对cifar10数据集等方法的处理
怎样删除对象的某个属性或⽅法
静态链表(数组的下标代替指针)
Static linked list (subscript of array instead of pointer)
Failure of vector insertion element iterator in STL
网上开户哪家证券公司佣金最低,我要开户,网上客户经理开户安全吗
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
Go 1.16.4: purpose of go mod tidy
[redis] cache warm-up, cache avalanche and cache breakdown
使用tensorflow进行完整的DNN深度神经网络CNN训练完成图片识别案例
RocksDB LRUCache
There is nothing new under the sun. Can the meta universe go higher?
Qt学习17 对话框及其类型
Complete deep neural network CNN training with tensorflow to complete picture recognition case 2
研发团队资源成本优化实践
Complete DNN deep neural network CNN training with tensorflow to complete image recognition cases