如何在Shiny应用中为文本添加边框
修改后的实现代码如下:
library(shiny) library(shinythemes) ui <- shiny::navbarPage(theme = shinytheme("flatly"), title="Test", collapsible = TRUE, tabPanel("", div( style = "height: 80px; background-color: #02BE7F; width: 100%; position: absolute; right:0;", h2(HTML("Project <b>Description</b>"), style="text-align:center;color: white"), hr(), div( style = "width: 70%; margin: 100px auto 0; border: 1px solid #ddd; border-radius: 6px; padding: 24px;", h2(HTML("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"), style="text-align:justify")), tags$style(".navbar {margin-bottom: 0;}") ) )) server <- function(input, output,session) { } shinyApp(ui = ui, server = server)
主要修改点是在文本外层div的样式中增加了border边框、border-radius圆角、padding内边距,同时调整了上外边距避免文本被顶部的绿色标题栏遮挡,边框样式和参考图效果一致。
参考样式图:
内容的提问来源于stack exchange,提问作者user16774617
相关产品推荐
相关产品推荐

