Spaces:
Runtime error

Afeefa123's picture
Update app.py
7427cc6 verified
Raw History Blame Contribute Delete
1.43 kB
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)