georad commited on
Commit
3a82c15
·
verified ·
1 Parent(s): e7f3391

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -6
app.py CHANGED
@@ -31,12 +31,51 @@ st.markdown("""
31
  padding-top: 3rem;
32
  }
33
 
34
- # --- PAGE SETUP ---
35
- type_text_page = st.Page(
36
- page="pages/type_text.py",
37
- title="DEMO (work in progress)",
38
- icon=":material/keyboard:",
39
- default=True,)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
 
42
  # --- Your Streamlit App ---
 
31
  padding-top: 3rem;
32
  }
33
 
34
+ /* Alternative approach: Create your own sticky header container */
35
+ div.sticky-header {
36
+ position: fixed;
37
+ top: 0;
38
+ left: 0;
39
+ right: 0;
40
+ z-index: 999999;
41
+ background-color: white;
42
+ padding: 1rem;
43
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
44
+ /* Ensures content below isn't hidden */
45
+ margin-bottom: 3rem;
46
+ }
47
+
48
+ /* Create space below custom sticky header */
49
+ div.sticky-header-spacer {
50
+ height: 6rem;
51
+ }
52
+ </style>
53
+ """, unsafe_allow_html=True)
54
+
55
+ # Option 1: Using Streamlit's native header (modified with CSS above)
56
+ st.title("My App with Sticky Header")
57
+
58
+ # Option 2: Custom sticky header implementation
59
+ # Uncomment and use this approach if the CSS-only solution doesn't work
60
+ """
61
+ # Custom sticky header container
62
+ st.markdown('<div class="sticky-header">', unsafe_allow_html=True)
63
+ st.title("My App with Custom Sticky Header")
64
+ # Add any other header elements here
65
+ st.markdown('</div>', unsafe_allow_html=True)
66
+
67
+ # Add spacer to ensure content isn't hidden under the header
68
+ st.markdown('<div class="sticky-header-spacer"></div>', unsafe_allow_html=True)
69
+ """
70
+
71
+ # Rest of your app
72
+ st.write("Scroll down to test the sticky header")
73
+
74
+ # Add dummy content to enable scrolling
75
+ for i in range(30):
76
+ st.write(f"Content block {i}")
77
+ st.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
78
+
79
 
80
 
81
  # --- Your Streamlit App ---