⚛️ HTML 转 JSXHTML to JSX Converter
把 HTML 片段改成更接近 React JSX 的写法:class→className、for→htmlFor、void 标签补上结尾斜杠、无值布尔属性改成 JSX 布尔写法、双引号 style 试着拆成对象形式。适合粘贴静态标记;复杂模板请再人工检查。Turn an HTML snippet toward React JSX: class→className, for→htmlFor, void tags get a trailing slash, bare boolean attrs become JSX booleans, and double-quoted style is split into an object. Good for static markup - review complex templates by hand.
" style="min-height:140px">使用说明与常见问题How-to & FAQ
「HTML 转 JSX」是什么?What is the HTML to JSX Converter tool?
把 HTML 片段改成更接近 React JSX 的写法:class→className、for→htmlFor、void 标签补上结尾斜杠、无值布尔属性改成 JSX 布尔写法、双引号 style 试着拆成对象形式。适合粘贴静态标记;复杂模板请再人工检查。Turn an HTML snippet toward React JSX: class→className, for→htmlFor, void tags get a trailing slash, bare boolean attrs become JSX booleans, and double-quoted style is split into an object. Good for static markup - review complex templates by hand.
如何使用「HTML 转 JSX」?How do I use the HTML to JSX Converter tool?
在「HTML 转 JSX」中,先在上方输入或粘贴内容,然后点击「转换」、「复制」按钮即可。In the HTML to JSX Converter: Type or paste your input above, then click "Convert", "Copy".
会改哪些属性?Which attributes change?
会替换 class 与 for;checked/disabled/readOnly 等无值布尔属性改成 JSX 布尔写法;area/br/img/input 等 void 元素补上 />。不会运行脚本,也不会解析 JSX 表达式。It rewrites class and for; bare booleans like checked/disabled/readOnly become JSX booleans; void elements such as area/br/img/input get />. It does not run scripts or parse JSX expressions.
style 一定正确吗?Is style always correct?
仅处理双引号 style="…",按分号拆成驼峰键。单引号、CSS 变量、!important 或 URL 里的分号可能不完整,请核对输出。Only double-quoted style="…" is split on semicolons into camelCase keys. Single quotes, CSS variables, !important, or semicolons inside URLs may be incomplete - check the output.
空输入与大段 HTMLEmpty input and large HTML
空内容会提示先粘贴 HTML。本页是正则/字符串启发式,不是完整 HTML 解析器;含模板语法(如 {{ }}、PHP)时请只转换纯标记部分。Empty input asks you to paste HTML first. This is a regex/string heuristic, not a full HTML parser - with templating ({{ }}, PHP), convert only the plain markup parts.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「HTML 转 JSX」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The HTML to JSX Converter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「HTML 转 JSX」免费吗?需要注册吗?Is the HTML to JSX Converter free? Do I need an account?
「HTML 转 JSX」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The HTML to JSX Converter is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.