闪亮的仪表板:仪表板边栏中的粘性页脚
Shiny Dashboard: Sticky Footer in dashboardSidebar
我正在尝试在 dashboardSidebar
中构建一个带有页脚的 Shiny Dashboard,它粘在视口底部。为此,我尝试按照建议 here 使用自定义 CSS 样式(谷歌搜索 "footer bottom 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 始终停留在指定的位置,给人一种黏黏的感觉。
我正在尝试在 dashboardSidebar
中构建一个带有页脚的 Shiny Dashboard,它粘在视口底部。为此,我尝试按照建议 here 使用自定义 CSS 样式(谷歌搜索 "footer bottom 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 始终停留在指定的位置,给人一种黏黏的感觉。