我希望我放在我的shiny
应用程序中的图像占据它的整个空间而不会溢出。这要求图像随窗口宽度改变其大小。
例如,假设我有以下代码:
library(shiny)
ui <- fluidPage(
tags$img(src = "https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon@2.png?v=73d79a89bded") # The important part
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
照原样,图像占据其正常的宽度和高度,在本例中为316x316
。我想让它占据它所拥有的整个水平空间,在本例中是整个窗口的宽度。我怎么能那样做?我所知道的那些小的CSS
都没有帮助(width=“100px”
是静态的,依此类推)。
试试看:
library(shiny)
ui <- fluidPage(
column(12,
tags$img(src = "https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon@2.png?v=73d79a89bded",
width="100%",height="600"
)
)
# The important part
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)