我正在尝试使用dashboardSidebar
中的页脚构建一个闪亮的仪表板,该页脚粘贴在视口的底部。为此,我尝试使用自定义CSS样式建议here(谷歌搜索“页脚底部引导程序”时的许多搜索结果之一):
# 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侧边栏中可视区域底部粘贴的页脚上有任何其他建议吗?
答案 0 :(得分:3)
尝试this
<div>
Sticky Footer
</div>
div{
position:fixed;
bottom:0;
right:0;
left:0;
background:#00adfc;
padding:10px;
box-sizing:border-box;
}
固定位置始终保持在指定位置并给人一种粘滞感。