I want to set image overlay a div. I want to get this :
I used left
and top
for image position but it doesnt work and I dont get the excepted result. This is what I did :
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)
Some help would be appreciated
Use position: relative on the parent and position: absolute on the child.
div {
width: 400px;
height: 200px;
background-color: lightcoral;
margin: auto;
}
.parent {
position: relative;
}
.child {
position: absolute;
top: -15px;
left: -15px;
background-image: url('https://picsum.photos/200');
width: 100px;
height: 100px;
}
<div class="parent">
<div class="child">
</div>
</div>