闪亮的仪表板:仪表板侧边栏中的粘性页脚

tch*_*rty 5 css r shiny shinydashboard

我正在尝试构建一个闪亮的仪表板dashboardSidebar,其中的页脚粘在视口的底部。为此,我尝试使用此处建议的自定义 CSS 样式(谷歌搜索“页脚底部引导程序”时的许多搜索结果之一):

# 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) {})
)
Run Code Online (Sandbox Code Playgroud)

由于我以前从未使用过自定义 CSS,因此我不确定我是否正确使用了 CSS。我正在按照此处的说明进行操作。

有人可以帮助解决这个 CSS 问题吗?或者对粘在闪亮仪表板侧边栏可视区域底部的页脚有任何其他建议吗?

San*_*mar 6

尝试这个

 <div>
    Sticky Footer
</div> 

div{
  position:fixed;
  bottom:0;
  right:0;
  left:0;
  background:#00adfc;
  padding:10px;
  box-sizing:border-box;
}
Run Code Online (Sandbox Code Playgroud)

位置固定始终停留在指定位置并给人一种粘性的感觉。