html - 更改一个 div 内两个 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 a或设置包含它的/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)
推荐阅读
- parsing - 如何在 yacc 中解释这条规则?"::" { yycolumn + = yyleng; 返回(TYPESEP 编号);}
- java - 如何在棉花糖中不授予 WRITE_SETTINGS 权限的情况下打开/关闭热点?
- wordpress - 如何在所有页面上显示所有子类别
- java - 如何编写一个函数来检测表 MySQL 中的不完整/错误过程?
- android - 无法在 react-native 的默认 WebView 上播放 hls
- jquery - jQuery 是否太重而无法在平板电脑上使用?
- amazon-dynamodb - Aws dynamodb 自动秤价格
- opengl - 如何使用 OpenGL(GLUT)在四个视口中渲染一个完整的茶壶(每个视口渲染茶壶的一部分)
- bash - 用另一个文件的字符串替换文件的字符串以进行匹配
- c# - EF Core - 通过 Fluent API 共享主键关联