簡體   English   中英

如何在 R Markdown 中自定義和設置 tabset.dropdown 樣式?

[英]How can I customize and style tabset.dropdown in R Markdown?

我想在 R Markdown 中更改我的下拉選項卡集的外觀。 例如,我希望我的下拉菜單在懸停時展開並更改框的整體外觀。 此外,我想在下拉列表中更改字體、顏色和文本對齊方式。 我在我的 .css 文件中嘗試了很多不同的方法,但都沒有成功。 請參閱下面的代碼和圖片。

這是我要自定義的下拉菜單

---
output:
  html_document:
    theme: paper
    highlight: tango
    number_sections: false
    toc: false
    toc_float: false
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

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

### Subject1 {.tabset .tabset-dropdown}

#### How can i customize this?

#### How can i customize this?

### Subject2 {.tabset .tabset-dropdown}

#### How can i customize this?

#### How can i customize this?

您需要在頂部的 r 代碼中添加 styles.css,也需要在文件夾中添加新文件。

代碼

---
output:
  html_document:
    theme: paper
    highlight: tango
    number_sections: false
    toc: false
    toc_float: false
    css: styles.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

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

### Subject1 {.tabset .tabset-dropdown}

#### How can i customize this?

#### How can i customize this?

### Subject2 {.tabset .tabset-dropdown}

#### How can i customize this?

#### How can i customize this?

CSS 代碼(styles.css):

.nav-tabs > li.active:nth-child(1) > a {
  background-color: #E8C120;
}

.nav-tabs > li > a {
  background-color: #5882A6;
  color: red;
}

輸出: 在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM