当前位置:网站首页>object-fit:cover; It doesn't work in the applet. How to deal with the deformation of the applet image
object-fit:cover; It doesn't work in the applet. How to deal with the deformation of the applet image
2022-07-19 01:29:00 【Pengzai studio】
I wrote an article the other day css Prevent image distortion object-fit: cover;
Use object-fit: cover; To prevent image distortion , It's a coincidence , I've developed and played these two days zblog Applet “ Dirty words ” The cover was just squeezed out of shape , therefore
, Just add this to the picture css attribute .
what? But there's no egg in it , At first I thought I had misspelled , I also made a special copy to try , It still doesn't work ......
Take a look at the contrast effect of the screenshot applet page first , The carousel on the left is squeezed , On the right side of the carousel, there is no extrusion , Keep the original size , The surplus is cut out , Obviously the visual effect on the right side is better .

Is this ...... Simple arrangement
Check the next small program documentation , The original wechat applet image does not support these css The attribute is , The authorities offered their own way , Only need to image add mode Attribute is enough , The corresponding parameters on the correspondence can be perfectly solved .
grammar
<image src="http://cdn.duanqinghua.com/duanqinghua/img/65.jpg" mode="aspectFill"></image>mode The legal value of
| value | explain |
|---|---|
| scaleToFill | Zoom mode , Do not keep aspect ratio zooming picture , Stretch the width and height of the picture completely to fill image Elements |
| aspectFit | Zoom mode , Keep the aspect ratio scaled , Make the long edges of the picture fully visible . in other words , The picture can be displayed completely . |
| aspectFill | Zoom mode , Keep the aspect ratio scaled , Only make sure that the short side of the picture is fully displayed . in other words , Pictures are usually complete only horizontally or vertically , Intercept will occur in the other direction . |
| widthFix | Zoom mode , The width does not change , Automatic height change , Keep the aspect ratio of the original image unchanged |
| heightFix | Zoom mode , The height remains the same , The width changes automatically , Keep the aspect ratio of the original image unchanged |
| top | Cut pattern , Unscaled picture , Show only the top area of the image |
| bottom | Cut pattern , Unscaled picture , Only the bottom area of the image is displayed |
| center | Cut pattern , Unscaled picture , Show only the middle part of the picture |
| left | Cut pattern , Unscaled picture , Only the left side of the image is displayed |
| right | Cut pattern , Unscaled picture , Show only the right area of the picture |
| top left | Cut pattern , Unscaled picture , Only the upper left of the image is displayed |
| top right | Cut pattern , Unscaled picture , Only the upper right of the image is displayed |
| bottom left | Cut pattern , Unscaled picture , Only the lower left of the image is displayed |
| bottom right | Cut pattern , Unscaled picture , Only the lower right part of the image is displayed |
Bug & Tip
tip:image Default width of component 320px、 Height 240px
tip:image The QR code in the component / Applet code image does not support long press recognition . Only in wx.previewImage Long press recognition is supported in
Official documents https://developers.weixin.qq.com/miniprogram/dev/component/image.html
The address of onlookers http://www.sharedblog.cn/post/226.html
Personal blog http://sharedblog.cn/
Software download http://iqzhan.com/

边栏推荐
猜你喜欢
![Buuctf [bjdctf2020]ezphp1 detailed explanation](/img/10/d2593dff2f4a5f0ca41a9f651128df.png)
Buuctf [bjdctf2020]ezphp1 detailed explanation
![[SWPU 2019] network TTL encryption and some related knowledge](/img/c7/8a4b6e7808be9189e76563848b359d.png)
[SWPU 2019] network TTL encryption and some related knowledge

服务器如何安装宝塔面板?(宝塔面板安装教程)

ModelArts-图像分类and物体检测

Pytoch simply uses the Minist dataset

About foreign key references, cross domain headers, and ref usage

Quine injection of SQL injection

深度之眼三——(3)】 數學:矩陣特征值與特征向量1

深度之眼三——(7)】数学:svd分解的应用

Initial flask
随机推荐
Win10 vscode 代码格式化设置与远程断点调试
【ElenmentUI el-date-picker日期选择器,结束时间不得早于开始时间,且只能选择距开始时间指定天数的日期】
RSA之共模攻击与共享素数
uniapp中text-indent不起作用,uniapp首行缩进不管用如何解决?
“我的”Bug大全(转载)
The C Programing Language-2nd--笔记--4.11.3
NodeJS 跨域 CORS
maker-论文资料查找培训-笔记
BUUCTF [BJDCTF2020]EzPHP1详解
Eye of depth III - (7, 8)] mathematics: matrix diagonalization and quadratic form 2.3
VsCode建立非工程目录下的头文件自动查找
深度之眼三——(4,5)】数学:矩阵特征值与特征向量2
Day15-分页,过滤
es可选链
MoveIt2——2.MoveIt在RViz中的快速入门
uni 阻止按钮多次点击 按钮多次点击
网站被黑,通过百度/搜狗等搜索关键词访问跳转到其他网站怎么办?
Detailed explanation of groupby
[GFCTF 2021]Baby_Web的CVE-2021-41773
XML外部实体注入总结(XXE靶机复现)