Tabs background color

I’m trying to to change the color of a tab (of all the tabs ) on my main page, so that it will remain transparent. I found the element in chrome’s devtool but just cant figure out how to translate that to style/style
The line in question is :
<div data-testid="stMarkdownContainer" class="css-16idsys e16nr0p34" style="background-color: green"><p>NAT GAS</p></div>

Use st.markdown()

st.markdown(  """
  <style>
  .css-16idsys.e16nr0p34 {
    background-color: green;
  }
  </style>
""", unsafe_allow_html=True)
1 Like

Like a charm! Thank you so much!!! :pray:

import streamlit as st

Use st.markdown with unsafe_allow_html=True

st.markdown(‘

NAT GAS

’, unsafe_allow_html=True)

Note: Be cautious when using unsafe_allow_html=True as it allows you to inject custom HTML and CSS. Make sure the content you inject is safe and doesn’t introduce security vulnerabilities.

For more information on this topic, you can refer to the Streamlit documentation on markdown.

This should help you change the tab’s background color to green as you requested.

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