Custom font not working

Hi,
I’m trying to use the custom font for my streamlit application but it’s not working. Here is my code for custom font

def apply_css(css):
    st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)

css = """
@import url('https://fonts.googleapis.com/css2?family=Hina+Mincho&display=swap');
html, body, [class*="css"]  {
    font-family: 'Hina Mincho', serif;
    font-size: 16px;
    font-weight: 100;
    }
"""

apply_css(css)

This is how the font looks like when I ran the application,
image

Hello,

try this

def apply_custom_css(css):
    st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)

custom_css = """
@import url('https://fonts.googleapis.com/css2?family=Hina+Mincho&display=swap');

body {
    font-family: 'Hina Mincho', serif;
    font-size: 16px;
    font-weight: 300;
}
"""

st.subheader("Hi,I’m trying to use the custom font for my streamlit application but it’s not working. Here is my code for custom font")

apply_custom_css(custom_css)

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