更改一个 div 中两个 div 的背景颜色 R Shiny
Change background color of two div inside one div R Shiny
我想更改其中有两个 div
的一个 div
的背景颜色。
我在UI写过:
div(
div(fileInput(inputId = "file1",
label = "File 1"),
style="min-width:200px;max-width:45%; float:left; margin-right:2.5%;"),
div(fileInput(inputId = "file21",
label = "File 2,1"),
fileInput(inputId = "file22",
label = "File 2,2"),
style="min-width:200px;max-width:45%; float:left;"),
style = "width: 100%; background-color:#ADD8E6;"),
但是颜色没有变化。
当我将背景颜色更改为每个单独的 div
时,它确实有效。但它看起来并不好看。
这就是为什么我想在更大的 div
.
中更改背景颜色
有什么想法吗?
也许他们是另一种实现此目的的方法。
要么你需要给那个父容器div一个height
,要么你给包含它的fluidPage
/fluidRow
设置样式:
library(shiny)
ui <- fluidPage(
div(
div(fileInput(inputId = "file1",
label = "File 1"),
style="min-width:200px;max-width:45%; float:left; margin-right:2.5%;"),
div(fileInput(inputId = "file21",
label = "File 2,1"),
fileInput(inputId = "file22",
label = "File 2,2"),
style="min-width:200px;max-width:45%; float:left;"),
# style = "width: 100%; background-color:#ADD8E6;") # height: 500px;
),
style = "width: 100%; background-color:#ADD8E6;"
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
我想更改其中有两个 div
的一个 div
的背景颜色。
我在UI写过:
div(
div(fileInput(inputId = "file1",
label = "File 1"),
style="min-width:200px;max-width:45%; float:left; margin-right:2.5%;"),
div(fileInput(inputId = "file21",
label = "File 2,1"),
fileInput(inputId = "file22",
label = "File 2,2"),
style="min-width:200px;max-width:45%; float:left;"),
style = "width: 100%; background-color:#ADD8E6;"),
但是颜色没有变化。
当我将背景颜色更改为每个单独的 div
时,它确实有效。但它看起来并不好看。
这就是为什么我想在更大的 div
.
有什么想法吗?
也许他们是另一种实现此目的的方法。
要么你需要给那个父容器div一个height
,要么你给包含它的fluidPage
/fluidRow
设置样式:
library(shiny)
ui <- fluidPage(
div(
div(fileInput(inputId = "file1",
label = "File 1"),
style="min-width:200px;max-width:45%; float:left; margin-right:2.5%;"),
div(fileInput(inputId = "file21",
label = "File 2,1"),
fileInput(inputId = "file22",
label = "File 2,2"),
style="min-width:200px;max-width:45%; float:left;"),
# style = "width: 100%; background-color:#ADD8E6;") # height: 500px;
),
style = "width: 100%; background-color:#ADD8E6;"
)
server <- function(input, output, session) {
}
shinyApp(ui, server)