我有以下代码片段:
sidebarPanel(
selectizeInput(
"s1",
"Select s1",
choices = c('A', 'B'),
multiple = FALSE
),
radioButtons(
"r1",
"Select r1",
choices = c("A", "B", "C")
),
radioButtons(
"r2",
"Select r2",
choices = c("P", "R")
),
selectizeInput(
"s3",
"Select s3",
choices = c('C', 'D'),
multiple = FALSE
),
selectizeInput(
"s4",
"Select s4",
choices = c('A', 'B'),
multiple = TRUE
),
actionButton(
"b1",
"Enter"
)
)
是否有办法减少字体大小,说20%,在这个边栏面板中包含的所有文本?或者,我可以在每个selectizeInput或radioButtons中更改字体大小吗?
你可以用div
来包装它,然后用style = "font-size:75%;"
来样式。对于selectizeInput
,你需要做同样的事情,因为它是一个不同的对象,你可以通过id或.selectize-input { font-size: 75%;}
整体来做:
library(shiny)
ui <- fluidPage(
tags$style(type='text/css', ".selectize-input { font-size: 75%;} .selectize-dropdown { font-size: 75%; }"),
div(style = "font-size:75%;",
sidebarPanel(
selectizeInput(
"s1",
"Select s1",
choices = c('A', 'B'),
multiple = FALSE
),
radioButtons(
"r1",
"Select r1",
choices = c("A", "B", "C")
),
radioButtons(
"r2",
"Select r2",
choices = c("P", "R")
),
selectizeInput(
"s3",
"Select s3",
choices = c('C', 'D'),
multiple = FALSE
),
selectizeInput(
"s4",
"Select s4",
choices = c('A', 'B'),
multiple = TRUE
),
actionButton(
"b1",
"Enter"
)
)
)
)
server <- function(input, output, session){
}
shinyApp(ui, server)