Spaces:
Runtime error
Runtime error
File size: 1,429 Bytes
7427cc6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import streamlit as st
import streamlit.components.v1 as components
# Title of the Streamlit app
st.title("Simple Streamlit App with HTML, CSS, and JavaScript")
# HTML, CSS, and JavaScript content
html_code = """
<!DOCTYPE html>
<html>
<head>
<style>
/* CSS for styling */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
h1 {
color: #4CAF50;
text-align: center;
}
.button {
display: block;
width: 200px;
margin: 20px auto;
padding: 10px 20px;
text-align: center;
color: white;
background-color: #4CAF50;
border: none;
border-radius: 5px;
cursor: pointer;
}
.button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>Welcome to My Streamlit App!</h1>
<button class="button" onclick="displayMessage()">Click Me</button>
<p id="message" style="text-align: center;"></p>
<script>
// JavaScript for interactivity
function displayMessage() {
document.getElementById("message").innerHTML = "You clicked the button!";
}
</script>
</body>
</html>
"""
# Embed HTML, CSS, and JS in the Streamlit app
components.html(html_code, height=400)
|