---
title: Streamlit st.html 注入全局 CSS 的坑:内容含 '<' 会被 DOMPurify 整段丢弃
type: experience
permalink: main/projects/8e229c96-a83b-4a02-ac40-10a0a9da444e/streamlit-st.html-注入全局-css-的坑内容含-会被-dompurify-整段丢弃
stable_id: 30702060-b113-4e9e-b1f0-2553e8b35046
scope: project
memory_type: experience
project_id: 8e229c96-a83b-4a02-ac40-10a0a9da444e
usage_profile_id: 7aee455b-24cc-4008-bdaf-443721e6f939
status: active
revision: 1
request_id: marketgrid-exp-sthtml-dompurify-20260917
created_at: '2026-09-17T01:51:39.047480+00:00'
updated_at: '2026-09-17T01:51:39.047480+00:00'
tags:
- streamlit
- css
- st.html
- dompurify
- ui
---
问题:在 ui/layout.py 的 COMPACT_CSS 中加入内联 SVG data URL(含 `