2015-05-29 99 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

相關問題