gpt4 book ai didi

css - Shiny 的仪表板 : Sticky Footer in dashboardSidebar

转载 作者:行者123 更新时间:2023-11-28 10:36:40 25 4
gpt4 key购买 nike

我正在尝试在 dashboardSidebar 中构建一个带有页脚的 Shiny Dashboard,它粘在视口(viewport)的底部。为此,我尝试按照建议使用自定义 CSS 样式 here (谷歌搜索“页脚底部 Bootstrap ”时的许多搜索结果之一):

# create an example for the SO question on sticky footer
library(shiny)
library(shinydashboard)

# sidebar
so_sidebar = dashboardSidebar(
sidebarMenu(
menuItem(
text = "Some text."
)
),
# footer here
tags$footer(
tags$p("Footer message here."),
style = "
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important; /* This line and the next line are not necessary unless you need IE6 support */
height: 100%;
margin: 0 auto -155px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 155px; /* .push must be the same height as .footer */
}

/*

Sticky Footer by Ryan Fait
http://ryanfait.com/

*/"
)

)

# compose the dashboard
so_ui = dashboardPage(
header = dashboardHeader(
title = "SO question"
),
sidebar = so_sidebar,
body = dashboardBody()
)

# run the application
shiny::shinyApp(
ui = so_ui,
server = shinyServer(function(input, output) {})
)

因为我以前从未使用过自定义 CSS,所以我不确定我是否正确使用了 CSS。我正在按照说明 here .

有人可以帮助使这个 CSS 正确,或者对粘在 Shiny Dashboard 侧边栏可视区域底部的页脚有任何其他建议吗?

最佳答案

尝试 this

 <div>
Sticky Footer
</div>

div{
position:fixed;
bottom:0;
right:0;
left:0;
background:#00adfc;
padding:10px;
box-sizing:border-box;
}

Position fixed 始终停留在指定的位置,给人一种粘性的感觉。

关于css - Shiny 的仪表板 : Sticky Footer in dashboardSidebar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37113739/

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