Issue
I have tabs (using tabset) in my Rmarkdown file. I was wondering if there was a way I could change the color of these tabs without needing to use a CSS file. Anyway, I could change this in the yaml part of my code or just wrap some html code around the tabset command to change the color of it? See below:
Solution
With Rmarkdown you can use inline CSS, so it's all contained in the same .Rmd file.
---
title: "tab colors"
output: html_document
---
<style>
.nav-pills>li>a:hover, .nav-pills>li>a:focus, .nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus{
background-color: green;
}
</style>
# {.tabset .tabset-fade .tabset-pills}
## green
You can also use CSS code in it's own CSS chunk, both give the same result inline, without an additional file
---
title: "tab colors"
output: html_document
---
```{css, echo = FALSE}
.nav-pills>li>a:hover, .nav-pills>li>a:focus, .nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus{
background-color: green;
}
```
# {.tabset .tabset-fade .tabset-pills}
## green
Used this link and this one in my research as they are similar questions
Answered By - Daniel Jachetta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.