---
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
project_id: 8e229c96-a83b-4a02-ac40-10a0a9da444e
memory_type: experience
status: active
revision: 1
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
created_at: '2026-09-23T15:01:37.094752+00:00'
updated_at: '2026-09-23T15:01:37.094807+00:00'
tags:
- streamlit
- css
- st.html
- dompurify
- ui
---
问题:在 ui/layout.py 的 COMPACT_CSS 中加入内联 SVG data URL(含 `