Search code examples
htmlrshinyline-breaks

How to add half a line break to shiny app?


I have a shiny app, and I want to add a small line break in between 2 objects--is it possible to specify that you want br() to be half it's regular size? I know if I wanted it to be double the size, I'd do br(), br(), but I don't know how to make it smaller.


Solution

  • Instead of br() you can add a margin to the bottom of the element of any size.

    library(shiny)
    
    ui <- fluidPage(
      p("Line 1"),
      br(),
      p("Line 2", style = "margin-bottom: 0px;"),
      p("Line 3", style = "margin-bottom: -10px;"),
      p("Line 4")
    )
    
    server <- function(input, output) {
    }
    
    shinyApp(ui = ui, server = server)