微信公众号文章文字背景

Posted by ... on 2026年10月30日

微信公众号编辑器

https://wxmd.2091k.cn

用下面代码把md文章包裹

1
2
3
4
<section style="background-color: #f8fafc; background-image: linear-gradient(rgba(0, 0, 0, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.06) 1px, transparent 1px); background-size: 20px 20px; padding: 24px 16px; color: #334155; border-radius: 8px;">


</section>

插入图片格式

  • 新建一个json,填入下面内容,在编辑器里导入格式
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[
  {
    "id": "422d0b7b-56a2-48ca-9583-e3ff70d59316",
    "name": "Img",
    "template": "<!-- 最外层控制宽度和居中,使用 section 标签微信兼容性最好 -->\n<section style=\"width: ; max-width: 100%; margin: 24px auto; box-sizing: border-box;\">\n\n  <!-- 相框层:用 border 模拟外框,用 padding 模拟相片白边 -->\n  <section style=\"padding: 10px; background-color: #ffffff; border: 1px solid #e5e5e5; border-radius: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);\">\n    \n    <!-- 图片层:必须加 !important,防止微信强行把图片放大到 100% 屏幕宽 -->\n    <img src=\"\" style=\"display: block; width: 100% !important; max-width: 100% !important; height: auto; border-radius: 6px; margin: 0 auto;\" alt=\"\" />\n    \n  </section>\n  \n  <!-- 底部文字:放在相框外面,排版更透气(如果不想要可删除) -->\n  \n  <section style=\"margin-top: 12px; text-align: center; font-size: 14px; color: #888888; line-height: 1.5;\">\n    \n  </section>\n  \n\n</section>",
    "props": [
      {
        "name": "imageUrl",
        "default": "https://jasuimg.521156.xyz/2091k/image/main/001/20260711152240_23mxis4j2k.png",
        "required": true
      },
      {
        "name": "width",
        "default": "80%",
        "required": true
      },
      {
        "name": "caption",
        "default": "图片",
        "required": true
      }
    ],
    "createdAt": 1793329003936,
    "updatedAt": 1793333463883
  }
]