Form elements using CSS

I have a form elements like name, address , phone number , which is aligned vertically in a webpage using streamlit.

I wanted to align each elements in a horizontal way side by side using CSS.

1 Like

Hi, Streamlit inherently supports horizontal alignment that can be done using st.columns. Please see our Docs for more info.

Thank you, i will have a look and try.

Here after aligning the elements horizontally, i wanted to resize the text fields of inputs.

Hi @keshav_dk, you can certainly make columns have different sizes.

Consider the following example:

import streamlit as st
import numpy as np

col1, col2 = st.columns([3, 1])
data = np.random.randn(10, 1)

col1.subheader("A wide column with a chart")

col2.subheader("A narrow column with the data")

Note: Code snippet from Streamlit Docs on st.columns

1 Like

Thank you @dataprofessor for the reply.

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