【发布时间】:2023-03-07 19:45:02
【问题描述】:
我使用left 和top 作为图像位置,但它不起作用,我没有得到例外结果。这就是我所做的:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
### i use div to integrate image here ###
div(
img(src = "https://images-na.ssl-images-amazon.com/images/I/61Jigwd1kKL._AC_SL1500_.jpg",
style = "left: 16px; width: 10%; border-radius: 50%; top: -60px;")
),
div(id = "id", style = "width: 500px; max-width: 100%; margin: 0 auto; padding: 20px;",
wellPanel(
tags$h2("my title", class = "text-center"),
div(actionButton("btn1", "click here"))
)
)
)
)
server <- function(input, output) { }
shinyApp(ui, server)
我们将不胜感激
【问题讨论】:
-
位置:相对于父div
-
正如 termaniafif 所说,img 和 h2 在同一个容器中的纯 HTML 示例:
<div id="id" style="width: 500px; max-width: 100%; margin: 5em auto; padding: 20px;position:relative;border:solid;"> <img src="https://images-na.ssl-images-amazon.com/images/I/61Jigwd1kKL._AC_SL1500_.jpg" style="left: -16px; width: 10%; border-radius: 50%; top: -30px;position:absolute"> <h2 class="text-center">my title</h2><button> click here</button> </div>
标签: html css r shiny shinydashboard