blob: bc2761f93369255bbda4c525574d2ec7f68a7284 [file] [log] [blame]
Hao Zhu94956582017-02-21 18:18:29 -05001---
2title: "htmlTable_styling Guide"
3output:
4 html_document:
5 number_sections: true
6vignette: >
7 %\VignetteIndexEntry{htmlTable Styling Guide}
8 %\VignetteEngine{knitr::rmarkdown}
9 %\VignetteEncoding{UTF-8}
10---
11
12# Basic HTML
13```{r}
14library(knitr)
15library(kableExtra)
16dt <- mtcars[1:5, 1:2]
17
18kable(dt, format = "html")
19```
20
21# Basic Bootstrap Table
22```{r}
23kable(dt, format = "html", table.attr = htmlTable_styling())
24```
25
26# Boostrap Table Options
27## Striped
28```{r}
29kable(dt, format = "html", table.attr = htmlTable_styling(bootstrap_options = "striped"))
30```
31
32## Striped + Hover
33```{r}
34kable(dt, format = "html", table.attr = htmlTable_styling(c("striped", "hover")))
35```
36
37## Other bootstrap options
38```{r}
39kable(dt, format = "html",
40 table.attr = htmlTable_styling(c("striped", "bordered", "hover", "condensed", "responsive")))
41```
42
43# "Thin" Table and Floating options
44```{r}
45kable(dt, format = "html",
46 table.attr = htmlTable_styling(
47 c("striped", "bordered", "condensed"),
Hao Zhu59f5fe02017-02-22 11:27:14 -050048 full_width = F
49 ))
50```
51
52```{r}
53kable(dt, format = "html",
54 table.attr = htmlTable_styling(
55 c("striped", "bordered", "condensed"),
56 full_width = F,
57 float = "left"
Hao Zhu94956582017-02-21 18:18:29 -050058 ))
59```
60
61
62