全局美化 v2
This commit is contained in:
@@ -468,8 +468,14 @@
|
||||
border-radius: var(--tb-radius) var(--tb-radius) 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tb-cover::after {
|
||||
/* ⚠️ 必须带 .uk-flex 复合选择器:UIkit 3.3.3 里有
|
||||
.uk-flex::after,.uk-flex::before{display:none}(优先级 0,2,0),
|
||||
会把这个遮罩伪元素整个干掉——不报错、只是什么都不显示(踩过一次)。
|
||||
单写 .tb-cover::after 优先级不够,会被它压回 display:none。 */
|
||||
.tb-cover::after,
|
||||
.tb-cover.uk-flex::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
|
||||
@@ -53,13 +53,15 @@ func TestGenPreview(t *testing.T) {
|
||||
// 提问箱主页:带背景图(渐变占位)+ 浅色文字,验证遮罩方向
|
||||
boxData := publicBaseData()
|
||||
boxData["VConsole"] = false
|
||||
boxData["Background"] = "data:image/svg+xml;utf8," +
|
||||
bgURI := "data:image/svg+xml;utf8," +
|
||||
strings.NewReplacer("#", "%23").Replace(
|
||||
`<svg xmlns='http://www.w3.org/2000/svg' width='900' height='500'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='#3b6ea5'/><stop offset='1' stop-color='#d98b6a'/></linearGradient></defs><rect width='900' height='500' fill='url(#g)'/></svg>`)
|
||||
// 注意:模板读的是 .PageUser.Background,必须写进 PageUser 里,否则 {{ if .PageUser.Background }} 为假、遮罩类不会渲染
|
||||
boxData["PageUser"].(map[string]interface{})["Background"] = bgURI
|
||||
boxData["PageUser"].(map[string]interface{})["Usernamecolor"] = "#ffffff"
|
||||
boxData["PageUser"].(map[string]interface{})["Introcolor"] = "#ffffff"
|
||||
// 无头 Chrome 里 uk-img 的懒加载不一定触发,这里直接把背景图写进 CSS 便于核对遮罩
|
||||
coverCSS := `<style>.tb-profile-cover{background-image:url("` + boxData["Background"].(string) +
|
||||
coverCSS := `<style>.tb-profile-cover{background-image:url("` + bgURI +
|
||||
`");background-size:cover;background-position:center;}</style>`
|
||||
for _, theme := range []string{"light", "dark"} {
|
||||
box, err := renderToString(t, "question/list", boxData)
|
||||
|
||||
Reference in New Issue
Block a user