我正在使用 Flex 仪表板工具来创建仪表板。仪表板有几个选项卡。我想知道如何将颜色应用于选项卡的标题/名称/标签。谢谢!
代码如下:
---
title: "A Template of Dashboard with Pages and Tabs"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: [ "twitter", "facebook", "menu" ]
---
<style>
body {
background-color: lightgray;
color: black;
}
.nav-tabs-custom > .nav-tabs > li.active {border-top-color: black; }
.tabset {
background-color: red;
border: 10px solid green !important;
}
</style>
## Column {data-width=120}
## Column {data-width=880 .tabset}
### Tab 1
### Tab 2
最佳答案
这可以像这样实现:
---
title: "A Template of Dashboard with Pages and Tabs"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: [ "twitter", "facebook", "menu" ]
---
```{css}
/* Set font color of inactive tab to green */
.nav-tabs-custom .nav-tabs > li > a {
color: green;
}
/* Set font color of active tab to red */
.nav-tabs-custom .nav-tabs > li.active > a {
color: red;
}
/* To set color on hover */
.nav-tabs-custom .nav-tabs > li.active > a:hover {
color: purple;
}
```
## Column {data-width=120}
## Column {data-width=880 .tabset}
### Tab 1
### Tab 2
关于r - 如何在 RSTudio 中为 Flex 仪表板选项卡的标签选择颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62186641/