【问题标题】:Dynamically large tags$img in ShinyShiny中的动态大标签$ img
【发布时间】:2021-07-20 19:10:48
【问题描述】:

我希望我在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" 是静态的,等等)。

【问题讨论】:

    标签: css r shiny


    【解决方案1】:

    试试这个:

    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)
    

    【讨论】:

    • 是的,"100% 工作......只要 StackOverflow 允许我,我会接受你的回答。
    猜你喜欢
    • 1970-01-01
    • 2020-10-15
    • 2012-04-17
    • 1970-01-01
    • 2019-02-05
    • 2019-05-04
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多