Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background image for bulmaHero? #39

Open
Jorge-hercas opened this issue Sep 5, 2021 · 1 comment
Open

Background image for bulmaHero? #39

Jorge-hercas opened this issue Sep 5, 2021 · 1 comment

Comments

@Jorge-hercas
Copy link

Hi and thanks for reading me.
Is it possible to put a background image instead of a single color in bulmaHero?

@marcin-karlinski
Copy link

Similar to the answer here jgthms/bulma#1007 , as a workaround you can add a class to the bulmaHero let's say ('has-bg-img') and then in CSS add the following line:

.has-bg-img { background: url('link/to/image.png')center center; background-size:cover; }

Working example:

if(interactive()){
  library(shiny)
  
  ui <- bulmaPage(
    tags$head(
      tags$style(HTML("
.has-bg-img { background: url('https://shiny.rstudio.com/blog/images/shiny-thumb.png')center center; background-size:cover; }
"
      ))
    ),
    bulmaHero(
      fullheight = TRUE,
      color = "danger",
      bulmaHeroBody(
        bulmaContainer(
          bulmaTitle("Hello Bulma*"),
          bulmaSubtitle("shinybulma*")
        )
      ),
      class = "has-bg-img"
    )
  )
  
  server <- function(input, output){}
  
  shinyApp(ui, server)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants