Css 如何使闪亮应用程序中的图像宽度动态?
我正在写一个应用程序,我希望侧边栏面板中的图像比我放进去的图像大一点。随着窗口变小或变大,侧边栏也会变大,但图像保持静止。如何解决此问题?有没有办法获得边栏长度,或者有没有更好的方法来渲染图像 用户界面 服务器.RCss 如何使闪亮应用程序中的图像宽度动态?,css,r,image,shiny,Css,R,Image,Shiny,我正在写一个应用程序,我希望侧边栏面板中的图像比我放进去的图像大一点。随着窗口变小或变大,侧边栏也会变大,但图像保持静止。如何解决此问题?有没有办法获得边栏长度,或者有没有更好的方法来渲染图像 用户界面 服务器.R library(shiny) shinyServer(function(input, output, session) { output$image <- renderImage({ return(list( src = "one.png
library(shiny)
shinyServer(function(input, output, session) {
output$image <- renderImage({
return(list(
src = "one.png",
contentType = "image/png",
height = 185,
alt = "Face"
))
})
})
库(闪亮)
shinyServer(功能(输入、输出、会话){
输出$image您可以使用css标记设置图像样式,如下所示:
shinyUI(bootstrapPage(
titlePanel("Sidebar Image App"),
tags$head(tags$style(
type="text/css",
"#image img {max-width: 100%; width: 100%; height: auto}"
)),
sidebarPanel(
imageOutput("image")
)
)),
其中css id选择器(此处为#image
)应与imageOutput
的outputId
相对应。如何添加图像源?
shinyUI(bootstrapPage(
titlePanel("Sidebar Image App"),
tags$head(tags$style(
type="text/css",
"#image img {max-width: 100%; width: 100%; height: auto}"
)),
sidebarPanel(
imageOutput("image")
)
)),