微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当 rmd 文件显示在闪亮的仪表板中时,背景颜色和文本对齐不起作用

如何解决当 rmd 文件显示在闪亮的仪表板中时,背景颜色和文本对齐不起作用

当我在 Rstudio 中编织下面的 .rmd 文件时,我得到了预期的结果,正文的左右空白(居中对齐)和预期的背景颜色。但是当我尝试通过闪亮的仪表板调用它时,空格不存在,背景颜色仍然是闪亮的仪表板的认颜色。

information2.rmd

---
output:
      html_document: default
      pdf_document: default
---
    
    <style type="text/css">
      body {
        width: 100%;
        height: 100%;
        background-color: linen;
    }
    .header{
        position: fixed;
        left: 0;
        width: 100%;
        height: 130px;
        display: block;
        background-color: linen;
    }
    .inner-header {
        width: 800px;
        height: 100%;
        display: block;
        margin: 0 auto;
    }
    .logo-container {
        height: 100%;
        display: table;
        float: left;
        padding-top: 20px;
    }
    .logo-text{
      font-size: 8pt;
        font-family: 'Chronicle display Light',Times,serif;
        text-align: left;
        color: #001641;
    }
    .navigation {
        float: right;
        height: 100%;
    }
    .navigation a {
        height: 100%;
        display: table;
        float: right;
        padding-left: 40px;
    }
    .navigation a li {
        display: table-cell;    
        vertical-align: middle;
        height: 100%;
        color: #001641;
        font-size: 12pt;
        font-family: 'Montserrat Light',sans-serif;
    }
    .outer-body{
        padding-top: 130px;
        background-color: linen;
        font-size: 12pt;
        font-family: 'Montserrat Light',sans-serif;
        text-align: justify;
    }
    .inner-body{
        width: 800px;
        height: 100%;
        background-color: white;
        display: table;
        padding: 20px 20px;
        margin: 0 auto;
    }
    .title{
        font-size: 40pt;
        font-family: 'Chronicle display Light',serif;
        text-align: right;
        padding-right: 20px;
    }
    H1{
        font-size: 24pt;
        font-family: 'Chronicle display Light',serif;
        text-align: left;
    }
    H2{
        font-size: 12pt;
        font-family: 'Montserrat Light',sans-serif;
        font-weight: bold;
        text-align: left;
    }
    .cont{
      display: table;
      margin: auto;
      height: 50px;
      width: 150px;
      font-size: 16pt;
      font-weight: bold;
      font-family: 'Chronicle display Light',serif;
      text-align: center;
      border: 2px solid;
      padding: 6px;
      background-color: linen;
    }
    .BoxBorder{
      border: 2px solid;
      padding: 6px 2px;
    }
    </style>
    
    # Participant information  
    
    ## What is this study called and who is involved?  
    The full title of this study is “Life,death and statins: Survival analysis of elderly general practice patients in relation to statin prescriptions”. The short title is “Life,death & statins.” The investigators are Dr Adam Hodgkins,A/Prof Judy Mullan,Dr Darren Mayne,and Prof Andrew Bonney. All investigators are affiliated with the University of Wollongong. 

闪亮的仪表板

library(shiny)
library(shinydashboard)
library(shinydashboardplus)
library(shinyjs)
library(knitr)
library(rmarkdown)

dbHeader <- dashboardHeaderPlus(disable = TRUE

    
)
shinyApp(
    ui = dashboardPagePlus(
        header = dbHeader,sidebar = dashboardSidebar(width = "0px",sidebarMenu(id = "sidebar" # id important for updateTabItems
                                               
                                   )          ),body = dashboardBody(
          
            
            useShinyjs(),tags$script(HTML("$('body').addClass('fixed');")),uIoUtput("info")
            
          
            
        )
        
    ),server<-shinyServer(function(input,output,session) { 
        hide(selector = "body > div > header > nav > a")
   
        
        output$info <- renderUI({
          
              isolate(HTML(markdown::markdownToHTML(knit('information2.rmd',quiet = TRUE),fragment.only=TRUE)))
          
        })
        
        
    }
    )
)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。