gpt4 book ai didi

r - 如何在 R Shiny 的 navbarPage 布局中移动导航选项卡?

转载 作者:行者123 更新时间:2023-12-01 13:48:56 25 4
gpt4 key购买 nike

我在 R 方面相当有经验,但在任何类型的 Web 开发方面都没有。我正在尝试使用 Shiny。

我只是在测试它并为用户界面提供以下内容:

shinyUI(navbarPage("This is some awesome testing!!!",
tabPanel("Plot"),
tabPanel("Summary" ),
navbarMenu("More",
tabPanel("Table"),
tabPanel("About")
)
))

这将生成一个带有导航栏的页面,如下所示,但请注意导航选项卡位于页面中间。有没有办法把它移到左边?所以它会一直对着页面的左侧?

我只是注意到调整窗口大小会使其周围移动一些并有助于将其向左移动更多,但是有没有办法让它“粘”到窗口的左侧?

enter image description here

我想有一些方法可以通过一些 css 或 html 或其他东西来强制它,但我什至不确定这些是否是正确的术语。同样,我在 Web 开发方面的经验为零。

谢谢!!

最佳答案

我认为您需要开始使用 css 来有效地修改默认的 Shiny 输出。在这里,它看起来像唯一的div需要修改的是第一个container .由于css不多,可以加上tags相当容易,

shinyApp(
shinyUI(
navbarPage("This is some awesome testing!!!",
tabPanel("Plot"),
tabPanel("Summary" ),
navbarMenu("More",
tabPanel("Table"),
tabPanel("About")
),
tags$head(tags$style('
nav .container:first-child {
margin-left:10px; width: 100%;
}'))
)),
shinyServer(function(input, output) {})
)

关于r - 如何在 R Shiny 的 navbarPage 布局中移动导航选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33425436/

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