如何在闪亮的仪表板中控制信息框的字体大小?

时间:2016-03-14 14:26:08

标签: r shiny dashboard

我想让信息框中的文字小于仪表板其余部分的文字。这是代码的dashboardBody部分:

dashboardBody(fluidRow(        

      box(
         title = "Box 1",
         width = 12, solidHeader = TRUE,
         status = "primary",
         uiOutput("myUiOutput")
      ),
      box(
         title = "Box 2",
         width = 12,
         solidHeader = TRUE,
         status = "warning",
         plotOutput("myPlot")
      ),
      infoBox(title = "my info box title", 
              value = "my info box message",
              subtitle = NULL,
              icon = shiny::icon("copyright"), color = "black", width = 12,
              href = NULL, fill = FALSE) 
 )) #<-end dashboardBody

我尝试在Box 1代码之前添加此标记,但它不起作用:

tags$head(tags$style(HTML('
    .info-box .logo {
    font-family: "Georgia", Times, "Times New Roman", serif;
    font-weight: bold;
    font-size: 8px;
  }
'))),

2 个答案:

答案 0 :(得分:2)

我同意,css命令不起作用很奇怪。但是试着写

value = tags$p(style = "font-size: 10px;", "my info box message")

而不是value,使其成为内联样式命令。

答案 1 :(得分:2)

另一种解决方案是将font-size设置为当您不知道当前px尺寸的情况时的百分比,例如

 value = tags$p("my info box message", style = "font-size: 50%;")
相关问题