mestreamlit / pages /994_自定义style.py
yuanjie
update
a18878f
raw
history blame
No virus
1.57 kB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : Python.
# @File : 994_自定义style
# @Time : 2022/10/17 上午11:45
# @Author : yuanjie
# @WeChat : meutils
# @Software : PyCharm
# @Description :
import streamlit as st
from streamlit.components.v1 import html
st.button('button背景色?换一个吧')
st.text_area('del', placeholder='Label多余?删了就好')
st.radio('想放大label字号, 修改字体吗?', ['想', '很想'])
st.markdown('''<style>
/* radio label字号、字体 */
#root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(3) > div > label {
font-size: 50px;
font-family: "Times New Roman", serif;
}
/* button背景色 */
#root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(1) > div > button {
background-color: black;
color: white;
}
/* radio选中项颜色 */
#root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(3) > div > div > label:nth-child(1) > div.st-co.st-cs.st-ct.st-cu.st-cv.st-cw.st-az.st-b4.st-cx.st-cy.st-cz.st-d0.st-d1.st-d2.st-c4.st-d3.st-d4.st-d5.st-b2.st-bl {
background-color: black;
}
</style>''', unsafe_allow_html=True)
js_delete = '''window.parent.document.querySelector("#root > div:nth-child(1) > div > div > div > div > section > div > div:nth-child(1) > div > div:nth-child(2) > div > label").remove()'''
html(f'''<script>{js_delete}</script>''',
width=0,
height=0)