Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 212041

set rmarkdown tab colors for different sections

$
0
0

I want to create an html with Rmarkdown. The html should contain colored tabs. Based on the answer from this question I tried to create a rmarkdown file, where I can set the colors of different tabs.

This is a minimal working example:

---
title: "tab colors"
author: "cettt"
output: 
  html_document:
  self_contained: no

---
<style>
  .nav-pills>li>a {
     color: red;
     }
  .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{
     color: black;
     background-color: red;
     }
  .nav-pills > li:nth-of-type(2)>a {
     color: green;
     }
  .nav-pills > li:nth-of-type(2)>a:hover, .nav-pills > li:nth-of-type(2)>a:focus, .nav-pills > li:nth-of-type(2).active>a {
     color: black;
     background-color: green;
     }
</style>

---

# {.tabset .tabset-fade .tabset-pills}

## red 1
## red 2

# {.tabset .tabset-fade .tabset-pills}

## green 1
## green 2

enter image description here

However, I would like the tab color of sections red1 and red2 to be in red and the tab colors of sections green1 and green2 in green. Does anyone have a suggestion for that?


Viewing all articles
Browse latest Browse all 212041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>