我需要使用dec显示一个图标(◼),但我的html技能非常有限。
我正在尝试并需要调整的内容:
htmltools::tags$span("I will display" , style="◼"),
htmltools::tags$span("I will display" , style="#9724;"),
htmltools::tags$style("I will display" , style="◼"),
htmltools::tags$style("I will display" , style="#9724;"),如何使用shiny的标签系统显示上面的图标?
https://www.w3schools.com/charsets/tryit.asp?deci=9724&ent=FilledSmallSquare
编辑:已更新。我需要的图标是DT标题的一部分。
datatable(
head(iris),
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ',
htmltools::tags$span("I will display" , style="◼"),
htmltools::tags$span("I will display" , style="#9724;"),
htmltools::tags$style("I will display" , style="◼"),
htmltools::tags$style("I will display" , style="#9724;"),
)
)发布于 2019-10-15 04:26:04
默认情况下,htmltools转义HTML内容,因此HTML实体中的“与”符号最终将转义为:
> htmltools::span("◼")
<span>&#9724;</span>您可以将原始超文本标记语言与htmltools::HTML()结合使用,如下所示:
DT::datatable(
head(iris),
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ',
htmltools::HTML("<span>I will display ◼</span>")
)
)或者在没有HTML转义的字符串中包含该符号:
DT::datatable(
head(iris),
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ',
htmltools::tags$span("I will display ◼ or \u25fc")
)
)发布于 2019-10-14 23:02:11
要在shiny中添加图标,可以使用ìcon。
library(shiny)
ui <- fluidPage(
htmltools::tags$span("I will display", icon("square"))
)
server <- function(input, output) {
}
shinyApp(ui, server)
}https://stackoverflow.com/questions/58378281
复制相似问题