I’m trying to adjust the alignment of bullets using HTML for text rendered in R Shiny modal dialogue, as shown in the image below. I’ve gone through sources like W3 Schools and haven’t found a solution yet. The example code, somewhat representative of my larger App, is posted at the bottom. Are there any solutions for this sort of bullet alignment?
Example code:
library(shiny)
ui <- fluidPage(fluidRow(uiOutput("header")))
server <- function(input, output, session) {
output$header <- renderUI({
fluidPage(
paste("Testing modal:"),
tags$button(
id = "show", class = "btn action-button",
tags$img(src = "https://images.plot.ly/language-icons/api-home/python-logo.png")
)
)
})
observeEvent(input$show, {
showModal(modalDialog(
tags$div(style="text-align:justify",
HTML("
<p>Studying the pig:</p>
<ul>
<li>Pigs eat anything</li>
<li>Pigs are fat</li>
</ul>
"))
))
})
}
shinyApp(ui, server)
2
Answers
Not sure it’s the best way:
Usually the indentation is controlled by setting the
padding-left
property of the ul-tag (it isn’t necessary to modify each li-tag):