如何在ShinyWidget中更改airDatepicker中日历图标的大小?

时间:2019-12-05 02:47:18

标签: r shiny shinydashboard shinywidgets

我在仪表板上使用airDatepicker中的shinyWidget

Here

我已成功更改了输入容器的大小(如图所示),但没有更改日历图标的容器(shinkywidget放置日历图标的框)。 我要更改的是黄色框,而不是用红色边框标记的图标本身。

当前我的代码如下:

tags$head( tags$style( HTML("
#choosedate {font-size: 13px; height: 25px;}
#datepickers-container > div > nav {font-size: 13px;}
#datepickers-container > div > div.datepicker--content {font-size: 13px;}
#datepickers-container > div > div.datepicker--buttons > span {font-size: 13px;}
#choosedate_button > i {font-size: 13px; max-height: 25px; height: 25px;}
")))

我将所有字体大小设置为13px,包括日历图标的大小。 在第六行,该部分无效:max-height: 25px; height: 25px;

我试图使用该行代码来更改日历图标容器的高度,以使其与设置为25px的datepicker输入容器匹配。

我该怎么做?
谢谢。

1 个答案:

答案 0 :(得分:1)

与您的previous question中的其他div相同的过程:

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$head(tags$style(HTML('
                            #choosedate {font-size: 75%}
                            #datepickers-container > div > nav {font-size: 75%;}
                            #datepickers-container > div > div.datepicker--content {font-size: 75%;}
                            #datepickers-container > div > div.datepicker--buttons > span {font-size: 75%;}
                            #choosedate_button > i {font-size: 75%;}
                            '))),
  airDatepickerInput(inputId = "choosedate", label = "month range", range = TRUE, placeholder = "choose month range", dateFormat = "M yy", view = "months", minView = "months", clearButton = TRUE,
                     autoClose = TRUE, update_on = "close", inline = FALSE, monthsField = "monthsShort", separator = " - ",
                     width = "161px", value = c("2010-01-01", "2019-12-31"), addon = "right")
)

server <- function(input, output, session) {}

shinyApp(ui, server)

Result