gpt4 book ai didi

bootswatch 中的 CSS 样式不适用于 Shiny R

转载 作者:行者123 更新时间:2023-12-04 11:46:41 27 4
gpt4 key购买 nike

我想改变我的 Shiny 应用程序的风格。我去了这里https://bootswatch.com/solar/并下载样式 .css file :“Solar A 旋转 Solarized”。

library(shiny)

ui <- fluidPage(
titlePanel(tags$i(h1(strong("My Panel Title"),style = "font-family: 'times'; font-size: 82px"))),align="center",
navbarPage(theme="bootstrap.min.css",title = 'Methods',
tabPanel('One'),
tabPanel('Two'),
tabPanel('Three'),
tabPanel('Four'))
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

但是正如您所看到的,导航栏看起来很奇怪:

nav bar with oversized title and small stacked links

我该如何解决?

最佳答案

您链接到的主题是 Bootstrap 4 主题,但是 Shiny uses Bootstrap 3 .对于兼容的 Bootswatch 主题,请参阅他们的 v3 合集:https://bootswatch.com/3/ .

例如,通过 CDN 使用 v3 Flatly 主题:

library(shiny)

ui <- fluidPage(
titlePanel(tags$i(
h1(strong("My Panel Title"), style = "font-family: 'times'; font-size: 82px")
)),
align = "center",
navbarPage(
theme = "https://stackpath.bootstrapcdn.com/bootswatch/3.4.1/flatly/bootstrap.min.css",
title = 'Methods',
tabPanel('One'),
tabPanel('Two'),
tabPanel('Three'),
tabPanel('Four')
)
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

enter image description here

关于bootswatch 中的 CSS 样式不适用于 Shiny R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58683274/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com