我正在尝试创建一个tabBox
横跨整个mainPanel
。我能够获得跨越整个屏幕的宽度,但无法获得同样的高度。我不希望使用像素(或其他单位)的绝对值,因为我希望该应用程序能够在不同的屏幕上使用。
我玩了这个例子和example http://rstudio.github.io/shinydashboard/structure.html#tabbox修改后的tabBox
如下
fluidRow(
tabBox(
title = "First tabBox",
# The id lets us use input$tabset1 on the server to find the current tab
id = "tabset1", height = "450px",
tabPanel("Tab1", "First tab content"),
tabPanel("Tab2", "Tab content 2"),
width = 12
),
height = '20%',
width = 12
)
您可以使用vh
css 单位定义为 1%视口高度 http://www.w3schools.com/cssref/css_units.asp然后基本上按照中的示例进行操作这个答案 https://stackoverflow.com/questions/26782041/scaling-shiny-plots-to-window-height在 css 中设置相对高度:
fluidRow(
tabBox(
tags$head(
tags$style(HTML(" #tabBox { height:90vh !important; } "))
),
id="tabBox",
title = "tabBox",
width = 12
)
当然,您也可以将其放入外部 css 文件中,特别是如果您要执行多个 css 技巧时。由于标题的原因,100% 会稍微超出底部边缘。大约 90% 似乎工作正常。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)