Html 如何减少闪亮中侧边栏的边框宽度?
我一辈子都找不到关于这件事的争论或问题,所以我要问: 如何修改Html 如何减少闪亮中侧边栏的边框宽度?,html,css,r,shiny,panel,Html,Css,R,Shiny,Panel,我一辈子都找不到关于这件事的争论或问题,所以我要问: 如何修改侧边栏面板周围间隙边框的大小(宽度或高度)? 我的最佳解决方案是通过div对单个元素使用边界值,但我想知道如何更改整个元素的边界 我们的目标是缩小边界差距,这样当我放大时,我就有了“更多的空间”来容纳我的元素(而不是让它们变得拥挤) 下面是显示“问题”的示例代码: 库(闪亮) ui如果我正确理解了你的意思,你只需要修改闪亮对象的CSS。在这种情况下,整个侧边栏面板具有html类以及 为了演示如何更改它,我将使用tableHTML::m
侧边栏面板周围间隙边框的大小(宽度或高度)
?
我的最佳解决方案是通过div
对单个元素使用边界值,但我想知道如何更改整个元素的边界
我们的目标是缩小边界差距,这样当我放大时,我就有了“更多的空间”来容纳我的元素(而不是让它们变得拥挤)
下面是显示“问题”的示例代码:
库(闪亮)
ui如果我正确理解了你的意思,你只需要修改闪亮对象的CSS。在这种情况下,整个侧边栏面板
具有html类以及
为了演示如何更改它,我将使用tableHTML::make_css
。此函数允许我们从ui中使用css对象,而无需加载.css文件。这将使演示变得非常容易:
如果我在你的侧边栏面板中添加标签$style(制作css(列表('.well','border width','10px'))
,保持所有其他内容不变:
sidebarPanel(width = 3,
div(style = "font-size: 8px;",
sliderInput(inputId = "groups",
label = "No. of Groups",
value = 4, min = 2, max = 12)
),
#tags style expects a css file
#which is what make_css creates
#the first element of the list is the html class to modify
#the second is the border-width
#the third is the value of the width
tags$style(make_css(list('.well', 'border-width', '10px'))),
fluidRow(
column(6,offset=0,
div(style = "height: 105px; padding: 0px 0px",
plotOutput(outputId = "scree")
)
)
您可以看到边框变为10px:
这意味着为了减少或删除它,您需要在css中指定0px
:
sidebarPanel(width = 3,
div(style = "font-size: 8px;",
sliderInput(inputId = "groups",
label = "No. of Groups",
value = 4, min = 2, max = 12)
),
tags$style(make_css(list('.well', 'border-width', '0px'))),
fluidRow(
column(6,offset=0,
div(style = "height: 105px; padding: 0px 0px",
plotOutput(outputId = "scree")
)
)
结果如下所示:
谢谢!标签$style代码放在哪里重要吗?非常欢迎!通常不会。即使你把它放在titlePanel
和sidebarPanel
之间,它仍然可以工作。甚至在fluidPage
之后。如果您想在shiny中轻松体验css,这里有一个关于如何使用make_css
的不错的教程。棒极了。我对这一切还是新手(5天前开始使用shiny/css/html),所以这些教程才是我真正需要的!非常感谢!!:太好了!非常乐意帮忙:)
sidebarPanel(width = 3,
div(style = "font-size: 8px;",
sliderInput(inputId = "groups",
label = "No. of Groups",
value = 4, min = 2, max = 12)
),
tags$style(make_css(list('.well', 'border-width', '0px'))),
fluidRow(
column(6,offset=0,
div(style = "height: 105px; padding: 0px 0px",
plotOutput(outputId = "scree")
)
)