Request for a way to maintain horizontal grid layouts (like 5x5 grids) on mobile devices, rather than forcing vertical column stacking.
Building interactive games, dashboards, or grid-based interfaces that need to maintain their structure across all device sizes. Current mobile behavior breaks grid-based layouts by forcing columns to stack vertically.
Sample Code (Always stacks vertically).
Any workarounds?
import streamlit as st
st.set_page_config(page_title=“Grid Layout Test”, layout=“wide”)
st.title(“5x5 Grid Layout Test”)
st.write(“Desktop/Tablet: Shows 5x5 grid”)
st.write(“Mobile: Stacks vertically (breaks grid layout)”)
CSS attempt to force grid layout
st.markdown(“”"
.grid-container [data-testid="column"] { width: 20% !important; flex: 0 0 20% !important; min-width: 20% !important; max-width: 20% !important; } @media (max-width: 767px) { .grid-container > div { display: flex !important; flex-direction: row !important; } .grid-container [data-testid="column"] { width: 20% !important; flex: 0 0 20% !important; } }“”", unsafe_allow_html=True)
st.markdown(‘
’, unsafe_allow_html=True)