Css 闪亮的仪表板:仪表板侧栏中的粘性页脚
我正在尝试构建一个闪亮的仪表板,仪表板侧栏中有一个页脚,它粘在视口的底部。为此,我尝试使用建议的自定义CSS样式(谷歌搜索“页脚底部引导”时的众多搜索结果之一): 因为我以前从未使用过自定义CSS,所以我不确定我是否正确使用了CSS。我按照指示去做 有人能帮你把这个CSS弄对吗,或者对粘在闪亮仪表板侧栏可视区域底部的页脚提出其他建议吗?试试看Css 闪亮的仪表板:仪表板侧栏中的粘性页脚,css,r,shiny,shinydashboard,Css,R,Shiny,Shinydashboard,我正在尝试构建一个闪亮的仪表板,仪表板侧栏中有一个页脚,它粘在视口的底部。为此,我尝试使用建议的自定义CSS样式(谷歌搜索“页脚底部引导”时的众多搜索结果之一): 因为我以前从未使用过自定义CSS,所以我不确定我是否正确使用了CSS。我按照指示去做 有人能帮你把这个CSS弄对吗,或者对粘在闪亮仪表板侧栏可视区域底部的页脚提出其他建议吗?试试看 粘脚 div{ 位置:固定; 底部:0; 右:0; 左:0; 背景:#00adfc; 填充:10px; 框大小:边框框; } 固定位置始终保持在指定位
粘脚
div{
位置:固定;
底部:0;
右:0;
左:0;
背景:#00adfc;
填充:10px;
框大小:边框框;
}
固定位置始终保持在指定位置,并提供粘性。谢谢。然而,这不是具体的,我不知道如何实现这一点。Shinny是一个通过编写R代码来生成HTML代码的R框架。实际上,我用Shinny实现了这一点——我将更新问题中的Shinny代码,并将其标记为正确。不过我还有一个问题。我怎样才能在这个文本上方得到一个也固定在视口底部的图像呢?在R样式中,你可以通过创建一个css类将css添加到
www/
文件夹中的css文件中,例如.sticky\u footer{position:fixed;bottom:0;right:0;left:0;background:#3c8dbc;z-index:1000;不透明性:0.9;}
。然后,您可以在仪表板主体中添加div
:div(class=“sticky\u footer”,p(“测试页脚”)
# 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) {})
)
<div>
Sticky Footer
</div>
div{
position:fixed;
bottom:0;
right:0;
left:0;
background:#00adfc;
padding:10px;
box-sizing:border-box;
}