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

Replace default height for "banner image" in grid listing by max-height #2999

Open
dragonstyle opened this issue Oct 23, 2022 Discussed in #2990 · 5 comments
Open

Replace default height for "banner image" in grid listing by max-height #2999

dragonstyle opened this issue Oct 23, 2022 Discussed in #2990 · 5 comments
Assignees
Labels
enhancement New feature or request listings
Milestone

Comments

@dragonstyle
Copy link
Collaborator

Discussed in #2990

Originally posted by mcanouil October 23, 2022
Hi,
currently, the grid listing has a default height of 150px for top image in the card which causes the image to be "cropped" in nearly all situations.
Instead, I would suggest to not set height property butmax-height to allow responsive scaling of the image without cropping the image.
For example, on the left, manually defined max-height, while on the right it's the default from the grid listing.
Screenshot of a grid listing made with quarto using a three columns layout and showing two cards. On the left a card with an image properly scaled without cropping and on the right a image vertically cropped due to css height property set to 150 pixels

A video to show the resizing issue of setting height.

resizing.mov
@dragonstyle dragonstyle added this to the v1.3 milestone Oct 23, 2022
@dragonstyle dragonstyle self-assigned this Oct 23, 2022
@dragonstyle
Copy link
Collaborator Author

I think that this item is likely more specifically creating a new type of listing layout that permits flexible grid sized (per the attached conversation). Moving to 1.4

@giabaio
Copy link
Contributor

giabaio commented Nov 29, 2023

Can I please ask if there's a follow up to this? I seem to have a problem that I think is related to this on this site; images are rescaled but the aspect ratio is not respected. As you make the screen smaller, then 2 things happen:

  1. The width of the columns becomes smaller and smaller and for some screen resolution, it's just not great (too narrow);
  2. The image is rescaled but the aspect ratio does not hold --- is there a way to force it?
    Thanks!

@dragonstyle
Copy link
Collaborator Author

I seem to have a problem that I think is related to this on this site; images are rescaled but the aspect ratio is not respected.

I think switching to max-height as suggested here really won't fix the width issue with this page - it merely allows the image height to change in order to preserve the aspect ratio. For example:

Screenshot 2023-11-30 at 4 17 34 PM

But, this has the effect of reducing the alignment of items within the grid, as titles and other data are in different spots, which I don't think we want in our default grid layout. Instead, perhaps you could consider changing the number of columns using grid-columns under listing (it defaults to 3) or perhaps changing the layout width of the page that this grid is on using page-layout: full which will make the content area wider.

@dragonstyle dragonstyle modified the milestones: v1.4, Future Nov 30, 2023
@mcanouil
Copy link
Collaborator

mcanouil commented Dec 1, 2023

As discussed initially in the discussion.
The best option would likely be around what Masonry.js does.
https://masonry.desandro.com/
(This would also bring "image gallerie" to Quarto)

@giabaio
Copy link
Contributor

giabaio commented Dec 2, 2023

Thanks both. I can look into this more closely, but I guess using masonry would basically amount to hacking the complied html files to add the relevant bits (including potentially a java script)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request listings
Projects
None yet
Development

No branches or pull requests

3 participants