我想将absolutePanel
的背景设置为透明,但面板中的所有控件都是正常的。
通过标签$ style添加css样式,但所有子控件都变为透明。我该怎么做到这一点?
PS:我的css代码不起作用
library(shiny)
ui <- shinyUI(
fluidPage(
tags$head(tags$style(
HTML('
#input_date_control {opacity : 0;}
#sel_date {opacity: 1;}')
)),
absolutePanel(
sliderInput('sel_date', NULL, 0, 5, 5, width = '80%')
, id = "input_date_control", class = "panel panel-default", fixed = TRUE
, draggable = FALSE, top = 'auto', left = '20', right = 'auto', bottom = 20
, width = '60%', height = 'auto'
)))
server <- function(input, output, session) {
}
shinyApp(ui, server)
答案 0 :(得分:2)
根据此页面中的建议:I do not want to inherit the child opacity from the parent in CSS,我解决了我的问题
library(shiny)
ui <- shinyUI(
fluidPage(
tags$head(tags$style(
HTML('
#input_date_control {background-color: rgba(0,0,255,0.2);;}
#sel_date {background-color: rgba(0,0,255,1);}')
)),
absolutePanel(
sliderInput('sel_date', NULL, 0, 5, 5, width = '80%')
, id = "input_date_control", class = "panel panel-default", fixed = TRUE
, draggable = FALSE, top = 'auto', left = 30, right = 'auto', bottom = 10
, width = '60%', height = 'auto'
)))
server <- function(input, output, session) {
}
shinyApp(ui, server)