繁体   English   中英

Shiny - 绘制列的右边框

[英]Shiny - Draw Right Border Of Column

假设我有以下 Shiny ui 代码:

fluidRow(
  column(
    width=4
  ),

  column(
    width=8
  )
)

如何绘制第一列的右边框?

您可以使用style参数将 CSS 添加到列中。 因此,一种方法是:

library(shiny)

ui <- fluidPage(
  fluidRow(
    column(style='border-right: 1px solid red',
      width=4,
      p('Hello')
    ),

    column(
      width=8,
      p('World')
    )
  )
)

server <- function(input,output) {}

shinyApp(ui,server)

希望这有帮助!

解决此问题的另一种方法是在对象(本例中为列)之外创建 html 样式,并为该列分配一个 css 类。 通过以这种方式创建样式,您可以更有效地将样式应用到另一列。

library(shiny)

ui <- fluidPage(
tags$head(
tags$style(HTML("
  
  .column_w_bar {
      border-right-color: #eb4034;
      border-right-width: 1px;
      border-right-style: solid;
}
") # end HTML
) # end tags$style
) # end tags$head

fluidRow(
  column(class = 'column_w_bar',
      width=4
  ),

  column(
      width=8
  )
 ) # end fluidRow
) # end FluidPage

在这个例子中,它在 R 代码中使用tags$head()tags$style()
您还可以在闪亮项目的“www”文件夹中的单独 .css 文件中创建样式。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM