Adding Border to a specific column

The border feature in st.column applies to all the columns.

But I want to apply border to only a specific column in a group of columns.

col1, col2, col3 = st.columns([1,2,1])
with col2:

    st.write("Column with border")

How do I Achieve this?

One way is to put a container with a border inside col2, like this:

import streamlit as st

col1, col2, col3 = st.columns([1, 2, 1], vertical_alignment="center")
with col1:
    st.write("Column 1")
with col2:
    with st.container(border=True):
        st.write("Column 2")
with col3:
    st.write("Column 3")

Result:

Thanks a million, it worked :+1::+1:

1 Like

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