Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在编辑器中第一个 HTML 元素自动设置 margin-top 为 0,但是拷贝到微信公众号后台还是会有默认的 margin-top? #404

Open
flyeric0212 opened this issue Sep 14, 2024 · 5 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@flyeric0212
Copy link

如题,如何让HTML 第一个元素的 margin-top 保持一致,都是 0 px。

@YangFong
Copy link
Member

这要观察后台的样式表现了。

  • 如果是被覆盖了,那可以试试 !important
  • 如果是抹除了,那就是不支持,需要用其他方式去模拟。

@flyeric0212
Copy link
Author

这个是编辑的表现:
image

直接拷贝到微信公众号:
image

@flyeric0212
Copy link
Author

这要观察后台的样式表现了。

  • 如果是被覆盖了,那可以试试 !important
  • 如果是抹除了,那就是不支持,需要用其他方式去模拟。

我截了下两张图

@YangFong
Copy link
Member

@flyeric0212 可以去除。下面是对比图:

image

@YangFong
Copy link
Member

但是,现在实现起来也不是很方便,因为自定义 CSS 并不支持伪类选择器,所以一设置,所有 <p> 都会受到影响。我这里临时提供两个方案:

  1. 复制之前,在开发者工具中手动设置样式。
  2. 打开开发者工具,复制一个标签出来改写。相比上一个方案来说,就是多了缓存。
image

@yanglbme yanglbme added help wanted Extra attention is needed question Further information is requested labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants