Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

WeChat Official Account HTML/CSS Support: Complete Reverse-Engineered Reference

WeChat Official Account HTML/CSS Support: Complete Reverse-Engineered Reference

The author reverse-engineers WeChat Official Account's editor by inserting all available components into a test article, previewing it, and analyzing the resulting HTML with AI assistance to document every supported tag, attribute, CSS property, and official component.

The article investigates which HTML tags and CSS styles WeChat Official Account (公众号) actually supports, since no official systematic documentation exists. The author creates a test article containing every insertable component from the editor toolbar — multimedia (images, video, audio) and extension capabilities (links, Mini Programs, templates, votes, search, location, Channels, profile cards, Q&A, gifts, monetization) — then uses the preview function and AI (Codex) to analyze the rendered HTML structure.

Basic HTML Tags (Text Layout)

p, br — Paragraphs and line breaks. Safe attributes: style (line-height, color, font-size, alignment, letter-spacing), class. Note: WeChat wraps each in an outer <section>; default line-height ~1.6–1.8.

span — Inline decoration. Safe attributes: style (color, font, background, weight, underline via text-decoration or border-bottom).

strong, b, em, i, u, s, del — Semantic/emphasis tags. Safe attribute: style (inherited). Strikethrough recommended via text-decoration: line-through.

h1–h3 — Headings. Safe attributes: style (font-size, color, alignment, weight, spacing). Editor often converts to h2/h1 with class=rich_media_title.

ul, ol, li — Lists. Safe attributes: style (line-height, color, indent). List markers preserved; customizable via list-style-type (disc, decimal, circle).

blockquote — Quotations. Safe attributes: style (left border, background, padding). Alternatively use official component mp-common-blockquote.

code, pre — Inline/block code. Safe attributes: style (monospace font, background). Long lines may force-wrap; avoid large pre blocks.

img — Images/GIFs. Safe attributes: src, data-src, data-w / data-h, style (width/height, border-radius, shadow). Recommend width ≤100%; WeChat replaces with CDN URL and adds data-imgfileid.

a — Hyperlinks. Safe attributes: href, target=_blank, style. WeChat adds redirect auth; usable for tables of contents and external links (only to Official Account articles).

table, thead, tbody, tr, td — Lightweight tables. Safe attributes: border, padding, text-align, background. Complex row/column spanning renders poorly.

section, div — Structure/containers. Safe attribute: style (arbitrary common layout properties). Editor heavily uses section wrappers; div also preserved.

Official Rich Media / Business Components

These custom elements are inserted by the editor and rendered as interactive cards:

&lt;mp-common-profile&gt; — Official Account profile card. Key attributes: data-nickname, data-headimg, data-alias, data-service_type. Click to follow or visit homepage.

&lt;mp-common-videosnap&gt; — Channels (视频号) video/live card. Key attributes: data-url, data-username, data-desc, data-width/height. Contains player placeholder; supports landscape/portrait.

&lt;mp-common-mpaudio&gt; — Audio player. Key attributes: name, author, voice_encode_fileid, play_length. Native audio control.

&lt;mp-common-vote&gt; — Vote card. Key attribute: data-votesubject (JSON). In-article voting.

&lt;mp-common-search&gt; — Search entry card. Key attributes: data-keywords, data-headimg, data-nickname. Internal site search.

&lt;a class="weapp_text_link"&gt; — Mini Program text link. Key attributes: data-miniprogram-appid, data-miniprogram-path. Opens Mini Program directly.

&lt;a class="wx_poi_link"&gt; — Location (POI) link. Key attributes: data-name, data-address, data-latitude/longitude. Opens map detail.

&lt;iframe src="//v.qq.com/txp/iframe/player.html?.."&gt; — Tencent Video embed. Only allowed external iframe type. Attributes: width/height, allowfullscreen.

&lt;mp-common-answer&gt; — "Ask Me" (问一问) Q&A card. Key attributes: data-question_text, data-content_text.

Safe Inline CSS Properties

Text

font-size, font-family, font-weight, color, letter-spacing, line-height, text-align, text-decoration, text-indent

Box Model

margin, padding, border, border-radius, box-shadow, background/background-color/background-image (including base64), width/max-width, height/max-height

Layout

display (block/inline/inline-block/flex), flex-* properties, justify-content, align-items, gap, float (use sparingly), vertical-align

Images / Animation

object-fit, border-radius, filter: brightness/contrast, transition/animation (simple only; complex animations usually ignored, avoid)

Content Typically Filtered or Broken

All <script> tags, inline event handlers ( onclick etc.), external CSS/JS. position: fixed/sticky, high z-index overlays, full-screen masks.

Complex SVG, Canvas, non-Tencent audio/video, iframes pointing outside Tencent Video.

Form elements ( input, textarea, button, select) usually stripped from article body.

The author concludes that WeChat Official Account does support complex layouts, but the capability boundary is opaque and undocumented, forcing creators into trial-and-error. The platform's reluctance to publish a clear spec — whether due to stability priorities or legacy baggage — remains frustrating.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

frontendreverse engineeringCSSHTMLrich text editorWeChat ecosystemWeChat Official Accountmp-common components

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion