Make left and right columns independent when expanded

If you’re creating


a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed? deployed
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform? internal company portal
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot).
  5. Share the Streamlit and Python versions. python 3.12, Streamlit, version 1.38.0

Attached screenshot of the issue.

i have created 4 columns in below fashion as expanders. when col1 is expanded col4 is being pushed down till the end of col1 leaving space between col2 and col4. Is there a way to fix the columns without moving when opposite side columns expand ?

col1 col2
col3 col4

Try only making two columns and writing to each one twice:

import streamlit as st

left, right = st.columns(2)

left.expander("Left Top Column Expander")
right.expander("Right Top Column Expander")
left.expander("Left Bottom Column Expander")
right.expander("Right Bottom Column Expander")

@ mathcatsand

Perfect. It worked. Thank you for the quick help

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.