Skip to content

How to fit image to fill dashboard card / row / column? #11995

Answered by Spacecortez
Spacecortez asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, I tried fixing it with CSS but wasn't succeeding.

I eventually found a solution - at the bottom of this post.

You're right that I was mistaken about quarto's .fill and .padding features.

So, in (S)CSS, I tried fixing .img-fluid to have height:100% so that the image would resize to its container. But I found that they still overflowed on the y-axis.

So I reverse-engineered how quarto makes code cell contents fit. Here I've replaced one of the placeholder images with a code cell that produces a simple plot. And the output of that plot will scale to fit into its container, while the images do not:

---
title: "My Dash"
format: 
  dashboard:
    orientation: columns
---

## Left Column {…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@mcanouil
Comment options

@mcanouil
Comment options

@mcanouil
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Spacecortez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
dashboards themes Related to HTML theming or any other style related issue (like highlight-style)
2 participants