Spaces:
Runtime error
Runtime error
Download app.py from Afeefa123/html-css-streamlit: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/spaces/Afeefa123/html-css-streamlit/resolve/main/app.py
- Command line
-
hf download hf://spaces/Afeefa123/html-css-streamlit/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Afeefa123/html-css-streamlit/resolve/main/app.py
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) | |