Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,58 +194,42 @@ BG_URL = "https://plus.unsplash.com/premium_photo-1679830513869-cd3648acb1db?q=8
|
|
| 194 |
st.sidebar.subheader("🎨 배경 설정")
|
| 195 |
use_img = st.sidebar.toggle("배경 이미지 사용", key="bg_on", value=True)
|
| 196 |
|
| 197 |
-
#
|
| 198 |
bg_layer_css = (
|
| 199 |
f"""
|
| 200 |
-
/* 이미지
|
| 201 |
background-image:
|
| 202 |
-
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
|
| 203 |
url('{BG_URL}');
|
| 204 |
background-position: center 45%, center 45%;
|
| 205 |
background-size: cover, cover;
|
| 206 |
background-repeat: no-repeat, no-repeat;
|
|
|
|
| 207 |
"""
|
| 208 |
-
if use_img
|
|
|
|
| 209 |
"""
|
| 210 |
-
/* 단색
|
| 211 |
-
background: #F1F1F1;
|
|
|
|
| 212 |
"""
|
| 213 |
)
|
| 214 |
|
| 215 |
st.markdown(f"""
|
| 216 |
<style>
|
| 217 |
-
/*
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
.stApp::before {{
|
| 226 |
-
content: "" !important;
|
| 227 |
-
position: fixed;
|
| 228 |
-
inset: 0; /* 풀스크린 */
|
| 229 |
{bg_layer_css}
|
| 230 |
-
pointer-events: none;
|
| 231 |
-
z-index: 0;
|
| 232 |
-
|
| 233 |
-
/* 중앙 컬럼 폭만 보이도록 좌우를 잘라냄 */
|
| 234 |
-
clip-path: inset(0 calc((100vw - var(--col-w)) / 2) 0 calc((100vw - var(--col-w)) / 2));
|
| 235 |
-
|
| 236 |
-
/* 페인팅 안정화(티어링 방지 보정) */
|
| 237 |
-
will-change: transform;
|
| 238 |
-
transform: translateZ(0);
|
| 239 |
}}
|
| 240 |
|
| 241 |
-
/*
|
| 242 |
-
.block-container > * {{ position: relative;
|
| 243 |
-
|
| 244 |
-
/* 모바일에서 성능 이슈가 있으면 여기서 이미지 모드만 스크롤형으로 전환 가능
|
| 245 |
-
@media (max-width: 768px){{
|
| 246 |
-
.stApp::before {{ background-attachment: scroll; }}
|
| 247 |
-
}}
|
| 248 |
-
*/
|
| 249 |
</style>
|
| 250 |
""", unsafe_allow_html=True)
|
| 251 |
|
|
|
|
| 194 |
st.sidebar.subheader("🎨 배경 설정")
|
| 195 |
use_img = st.sidebar.toggle("배경 이미지 사용", key="bg_on", value=True)
|
| 196 |
|
| 197 |
+
# 배경 CSS (둘 중 하나만 적용)
|
| 198 |
bg_layer_css = (
|
| 199 |
f"""
|
| 200 |
+
/* ✅ 이미지: center 45%, cover, 고정 + 15%만 보이도록 반투명 흰색 오버레이 */
|
| 201 |
background-image:
|
| 202 |
+
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)), /* ← 이미지 투명도 효과 */
|
| 203 |
url('{BG_URL}');
|
| 204 |
background-position: center 45%, center 45%;
|
| 205 |
background-size: cover, cover;
|
| 206 |
background-repeat: no-repeat, no-repeat;
|
| 207 |
+
background-attachment: fixed, fixed; /* 스크롤해도 끊김 없음 */
|
| 208 |
"""
|
| 209 |
+
if use_img
|
| 210 |
+
else
|
| 211 |
"""
|
| 212 |
+
/* ✅ 단색: 중앙 컬럼에만 적용 + 스크롤 고정 */
|
| 213 |
+
background-color: #F1F1F1;
|
| 214 |
+
background-attachment: fixed; /* 요소 배경을 뷰포트에 고정 */
|
| 215 |
"""
|
| 216 |
)
|
| 217 |
|
| 218 |
st.markdown(f"""
|
| 219 |
<style>
|
| 220 |
+
/* 전역 배경 리셋만 수행 (컬럼 pseudo는 건드리지 않음) */
|
| 221 |
+
.stApp::before, .stApp::after {{ content: none !important; }}
|
| 222 |
+
.stApp {{ background: transparent !important; }}
|
| 223 |
+
|
| 224 |
+
/* 중앙 컬럼 */
|
| 225 |
+
.block-container {{
|
| 226 |
+
position: relative;
|
| 227 |
+
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
{bg_layer_css}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}}
|
| 230 |
|
| 231 |
+
/* 콘텐츠가 배경 위에 보이도록 보정 (z-index 필요 없음) */
|
| 232 |
+
.block-container > * {{ position: relative; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
</style>
|
| 234 |
""", unsafe_allow_html=True)
|
| 235 |
|