html - Gmail 右侧边距与左侧边距不一样
问题描述
我有一个从内容生成 html 的注释编辑器,我有一个图像工具,用户可以在其中添加插图,就像左边距和右边距一样移动图像但是当我使用左边距时它工作正常但是当我尝试向右添加边距,然后 gmail 不显示正确的边距(值是正确的,但在视觉上它不匹配)
html
<div
style={{
width: "{{full_width_percent_override}}", // Evaluates to 100%
textAlign: "right",
}}
>
<figure
style={{
width: "{{full_width_percent_override}}", // Evaluates to 100%
display: "inline-block",
marginTop: "0px",
marginBottom: "0px",
marginRight: `${Math.abs((inset < 0 ? inset : 0) * 16)}px`,
marginLeft: `${Math.abs((inset > 0 ? inset : 0) * 16)}px`,
}}
>
<a
href={url as string}
style={{
border: "none",
display: "inline-block",
height: "auto",
marginTop: "0px",
marginBottom: "0px",
marginRight: `${Math.abs((inset < 0 ? inset : 0) * 16)}px`,
marginLeft: `${Math.abs((inset > 0 ? inset : 0) * 16)}px`,
padding: "0",
textDecoration: "none",
width: "auto",
}}
>
<img
alt={altText as string}
style={{
border: "none",
display: "block",
height:
height && width < IMAGE_MAX_WIDTH_EMAIL
? (height as string)
: "auto",
margin: "0 auto",
maxWidth: IMAGE_MAX_WIDTH_EMAIL,
verticalAlign: "middle",
width: width,
}}
src={url as string}
/>
{caption ? (
<figcaption
style={{
textAlign: alignOption ? alignOption : "center",
color: captionColor
? (captionColor as string)
: "#8c8d91",
fontSize: "1rem",
paddingLeft: "0.2em",
paddingRight: "0.2em",
marginTop: "1em",
marginBottom: "1em",
}}
>
{caption}
</figcaption>
) : null}
</a>
</figure>
</div>
```
Image with margin right
[1]: https://i.stack.imgur.com/O4wGK.png
Image with margin left
[2]: https://i.stack.imgur.com/CzDQH.png
解决方案
推荐阅读
- reactjs - mui 主题颜色不适用
- apache-spark - 如何根据 Pyspark 中的单元格值重命名列?
- angular - Angular Web-app 麦克风切换导致错误“NotReadableError:并发麦克风进程限制”
- angular - Angular 以 dd/MM/yyyy HH:mm 格式获取过去 24 小时的日期
- c# - 如何使用 c# 从 ajax 中的嵌套 JSON 对象中获取值
- sql - 如何在 Oracle SQL 中仅针对某些组织运行查询条件
- reactjs - 在 react dropzone 上传器的网格中设置图像
- r - 从现有对计算几个新变量并将新变量值与 R 中的其他变量标准化
- slurm - 通过 Slurm REST API 提交 OpenMPI 作业失败
- php - 在 API 请求中上传文件时 POST 请求中的 nginx 502 错误