Hi,
I have 2 buttons which are close to each other i.e. one button on top and one button below it. Is there a way to add extra line space in between the 2 buttons ?
Thanks
Hi,
I have 2 buttons which are close to each other i.e. one button on top and one button below it. Is there a way to add extra line space in between the 2 buttons ?
Thanks
Hey @demoacct - you can use st.text
with an empty string to insert extra line space:
import streamlit as st
st.button("button 1")
st.text("")
st.button("button 2")
@demoacct Hi mate, you could use the following command below. He will create a line, maybe given to you air of separation. This command it’s (i’m not sure) the same as when you use at jupyter notebook, github markdown.
import streamlit as st
st.button("First button")
st.markdown("***")
st.button("Second button")
Hii!
Can anyone tell…I want to bring my heading in centre…so I need to ad some spaces before that…
How can I do that??
Hi @Akash743! Firstly, welcome to the Streamlit community!!
I realize that both st.title
and st.header
don’t center the text by default. Are you seeing them a bit to the left of the screen as well?
To position them in the middle of your page, you could use st.beta_columns to create three columns and display the title/header in the middle column. To leave enough room for medium-to-long headings, you can size the middle column to be twice as wide as the left and right columns. Below, I’ll compare the before and after versions:
import streamlit as st
st.title("This is my heading")
import streamlit as st
_, col2, _ = st.beta_columns([1, 2, 1])
with col2:
st.title("This is my heading") # you can use st.header() instead, too
Is this what you were looking for?
Happy Streamlit-ing!
Snehan
Thanks you very much
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.