【问题标题】:How do I change the size of calendar icon in airDatepicker from shinyWidget?如何从 shinyWidget 更改 airDatepicker 中日历图标的大小?
【发布时间】:2020-03-29 22:20:39
【问题描述】:

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

Here

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

目前我的代码如下所示:

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,包括日历图标的大小。 在第 6 行,这部分不起作用:max-height: 25px; height: 25px;。

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

我该怎么做?
谢谢。

【问题讨论】:

    标签: r shiny shinydashboard shinywidgets


    【解决方案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)
    

    【讨论】:

    • 它适用于日历图标本身,但实际上我想要更改的是图标的容器(shinywidget 放置日历图标的框)。我在我的问题中编辑了图片。请再次检查。谢谢。
    猜你喜欢
    • 2020-03-27
    • 1970-01-01
    • 2019-11-10
    • 1970-01-01
    • 2014-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多