我正在使用 rmarkdown 编写 html 文档。我想将作者(可能还有日期)固定在左下角(在侧边栏中)。
我有点知道我需要以某种方式让这种风格起作用
.sidebar-footer{
height: 50px;
position: absolute;
width: 100%;
bottom: 0;
list-style-type: none;
padding-bottom:5.5em;
}
我的 rmd 文件是:
---
title: "project"
author: "Name"
date: "11/12/2020"
output:
html_document:
toc: true
toc_float: true
toc_collapsed: true
toc_depth: 3
theme: lumen
highlight: default
css: www/css/master.css
---
```{css}
tocify.sidebar-footer{
height: 50px;
position: absolute;
width: 100%;
bottom: 0;
list-style-type: none;
padding-bottom:5.5em;
}
```
<div style="sidebar-footer"> hello
</div>
# Level one
```{r}
plot(1:10,2:11)
```
## level two
### level three
# level one a
我的自定义 css 是
#TOC{
margin: 0 !important;
height: 100%;
border: none;
padding: 0;
background-color: #f8f8f8;
left: 0;
border-right: 1px solid #e7e7e7}
.tocify{
background-color: #f8f8f8;
border-radius: 0px;
}
.list-group-item{
background-color: #f8f8f8;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 100% !important;
}
我不太熟悉 html 和 css 的工作原理,所以希望得到任何帮助。 R 有默认的 css 生成浮动目录等
答案 0 :(得分:0)
猜想如果你使用闪亮的和闪亮的仪表板会更容易。
这是一个完整的例子。
首先,您需要准备一个新的闪亮的网络应用程序。从 RStudio > 文件 > 新建文件 > Shiny Web App(下面 1),然后选择单个文件应用(下面 2)。
最后复制/粘贴以下代码。
## app.R ##
library(shiny)
library(shinydashboard)
author <- "John Doe"
ui <- dashboardPage(
dashboardHeader(title = "TestApp"),
dashboardSidebar(HTML(paste0(
"<div style='position: absolute; bottom: 5px;'>",
author,"<br>",Sys.Date(),
"</div>"
))
),
dashboardBody("Hello")
)
server <- function(input, output) { }
shinyApp(ui, server)