gpt4 book ai didi

html - 在 Jekyll 的 CSS 中使用 liquid tempting 以每页为基础调整 div 的背景颜色

转载 作者:太空宇宙 更新时间:2023-11-04 13:05:31 25 4
gpt4 key购买 nike

我正在为我的 website 使用 Jekyll 和 Liquid .

我一直坚持在 CSS 中使用 liquid 来正确编译。我正在尝试为每个页面的边框使用不同的颜色,并将默认设置为黑色。

我很感激你们可能有的任何见解。

   #splash {width: 100%; height: 10%;}
#splash background-color: {% if page.accent %}{{ page.accent }}{% else %}{{ black }}{% endif %}
<div id= "splash"> </div>

最佳答案

您需要在文件顶部添加 2 行 --- 才能正确编译。

来源:https://jekyllrb.com/docs/assets/

您还需要在背景颜色的 css 代码周围添加 {

---
---

#splash {
width: 100%; height: 10%;
}

#splash {
background-color: {% if page.accent %}{{ page.accent }}{% else %}{{ black }}{% endif %};
}

或者,您可以像这样合并 2 个 CSS 语句:

---
---

#splash {
background-color: {% if page.accent %}{{ page.accent }}{% else %}{{ black }}{% endif %};
height: 10%;
width: 100%;
}

关于html - 在 Jekyll 的 CSS 中使用 liquid tempting 以每页为基础调整 div 的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42524517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com