2015-05-29 98 views
9

如何更改选择标签中的字体大小?闪亮 - 如何更改选择标签中的字体大小?

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

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(...) 
     ), 
    .... 

任何想法?

回答

18

你有正确的想法,但闪亮的选择输入实际上使用selectize JavaScript来显示UI而不是传统的selectHTML标记。这就是为什么你的CSS没有抓住。

你想要的,而不是select CSS什么是".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) { 
    } 
)) 
+0

感谢这么多的帮助! – laukok

+0

是否可以更改许多selectInput按钮的字体大小,该ID是从“SelectInputXYZ ...”开始的?我知道如果你想使用特定的按钮,而不是'.selectize-input',你可以使用'#SelectInputXYZ1',但是我试图把它放在renderUI中,它不起作用。 – user3463225

+0

你也可以改变selectInput标签的字体吗? – SarahGC

相关问题