Change font size of tabs

Is it possible to change the font size when working with st.tabs()?

Thanks

You can with a CSS hack:

import streamlit as st

animals = ['cat','dog','bird']

tabs = st.tabs(animals)

with tabs[0]:
    st.write('Meow' + ' meow'*100)
with tabs[1]:
    st.write('Woof' + ' woof'*100)
with tabs[2]:
    st.write('Tweet' + ' tweet'*100)

css = '''
<style>
    .stTabs [data-baseweb="tab-list"] button [data-testid="stMarkdownContainer"] p {
    font-size:2rem;
    }
</style>
'''

st.markdown(css, unsafe_allow_html=True)
3 Likes

Very good, thanks.

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