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.
Reading font
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:
<mp-common-profile> — Official Account profile card. Key attributes: data-nickname, data-headimg, data-alias, data-service_type. Click to follow or visit homepage.
<mp-common-videosnap> — Channels (视频号) video/live card. Key attributes: data-url, data-username, data-desc, data-width/height. Contains player placeholder; supports landscape/portrait.
<mp-common-mpaudio> — Audio player. Key attributes: name, author, voice_encode_fileid, play_length. Native audio control.
<mp-common-vote> — Vote card. Key attribute: data-votesubject (JSON). In-article voting.
<mp-common-search> — Search entry card. Key attributes: data-keywords, data-headimg, data-nickname. Internal site search.
<a class="weapp_text_link"> — Mini Program text link. Key attributes: data-miniprogram-appid, data-miniprogram-path. Opens Mini Program directly.
<a class="wx_poi_link"> — Location (POI) link. Key attributes: data-name, data-address, data-latitude/longitude. Opens map detail.
<iframe src="//v.qq.com/txp/iframe/player.html?.."> — Tencent Video embed. Only allowed external iframe type. Attributes: width/height, allowfullscreen.
<mp-common-answer> — "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-indentBox Model
margin, padding, border, border-radius, box-shadow, background/background-color/background-image (including base64), width/max-width, height/max-heightLayout
display (block/inline/inline-block/flex), flex-* properties, justify-content, align-items, gap, float (use sparingly), vertical-alignImages / 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.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.