gpt4 book ai didi

css - 如何更改嵌套 Accordion 中特定 Accordion 的背景颜色?

转载 作者:行者123 更新时间:2023-11-28 14:06:56 30 4
gpt4 key购买 nike

我正在尝试更改嵌套 Accordion (primeng) 中 Accordion (第一个 child )的背景颜色?

<p-accordion>
<p-accordionTab header="Header 1">
<p-accordion>
<p-accordionTab header="Header 1">
Content 1
</p-accordionTab>
<p-accordionTab header="Header 2">
Content 2
</p-accordionTab>
<p-accordionTab header="Header 3">
Content 3
</p-accordionTab>
</p-accordion>
</p-accordionTab>
</p-accordion>

最佳答案

我能想到的一种解决方案如下:

1) 添加一个 id 标签到你的 child accordion:

<p-accordion>
<p-accordionTab header="Header 1">
<p-accordion>
<p-accordionTab id="firstaccordion" header="Header 1">
Content 1
</p-accordionTab>
<p-accordionTab header="Header 2">
Content 2
</p-accordionTab>
<p-accordionTab header="Header 3">
Content 3
</p-accordionTab>
</p-accordion>
</p-accordionTab>
</p-accordion>

2) 然后转到您的 styles.css 并添加:

#firstaccordion .ui-accordion-content{
background-color: blueviolet !important; //your choice colour
}

关于css - 如何更改嵌套 Accordion 中特定 Accordion 的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57096002/

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