Opengist

Explore

  • All gists
  • Topics
  • Users
Give feedback on the new UI Powered by Opengist ⋅ 387ms

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login
i

integration

Recently created Least recently created Recently updated Least recently updated

timmy / Streamlit 嵌入 HTML

Last active 5 hours ago css customization html integration javascript streamlit ui webapp

此範例展示如何在 Streamlit 應用中嵌入 HTML、CSS 和 JavaScript,允許自訂 UI 元素、樣式和互動功能,使 Web 應用更具靈活性和可視化效果。

0 0 0 2
1 import streamlit as st
2
3 st.title("嵌入 HTML 的範例")
4
5 html_code = """
6 <div style="border: 2px solid #4CAF50; padding: 10px; border-radius: 5px;">
7 <h2 style="color: #4CAF50;">這是一個 HTML 區塊</h2>
8 <p>你可以在這裡嵌入 HTML, CSS, 甚至 JavaScript。</p>
9 <button onclick="alert('Hello, Streamlit!')">點擊我</button>
10 </div>