闪亮-如何更改选择标签中的字体大小? [英] Shiny - how to change the font size in select tags?

查看:20
本文介绍了闪亮-如何更改选择标签中的字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改选择标记中的字体大小?

我尝试使用下面的代码,但字体大小根本没有更改。

shinyUI(fluidPage(

  sidebarPanel(

    # Change the font size.
    tags$style(type='text/css', "select {font-size: 32px !important} "),

    # Species/ pollutant options
    selectInput(
        inputId = "species",
        label = "Species:",
        choices = c(...)
        ),
   ....

有什么想法吗?

HTML

您的想法是正确的,但是SHILINY中的SELECT输入实际上使用了select javascript来显示UI,而不是传统的select推荐答案标记。这就是您的CSS不受欢迎的原因。

您想要的而不是selectCSS是".selectize-input { font-size: 32px; }

但是,如果您只有CSS,则下拉菜单选项仍将是默认大小,而且文本周围也不会有填充,这看起来非常笨拙。以下是您可能想要使用的一些CSS:

.selectize-input { font-size: 32px; line-height: 32px;}
.selectize-dropdown { font-size: 28px; line-height: 28px; }

因此将其添加到应用程序会得到以下结果:

runApp(shinyApp(
  ui = fluidPage(
    tags$style(type='text/css', ".selectize-input { font-size: 32px; line-height: 32px;} .selectize-dropdown { font-size: 28px; line-height: 28px; }"),
    selectInput("test","Test", 1:5)
  ),
  server = function(input, output, session) {
  }
))

这篇关于闪亮-如何更改选择标签中的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆