Hi,
I’m looking to modify the slideshow within Dawn so that rather than stretching the image to fill the width, and then cropping the top/bottom of the image (damned ugly, if you ask me), it will operate at a fixed height and scale the image width to fit with NO cropping. This seems to be the only option that was not included by the authors, but the most elegant (in my opinion).
I’ve been playing with the css and liquid, but to no avail. I think that if I can get the actual image’s dimensions, I can force a scale, but I can’t seem to find which liquid variables they would be.
I also tried removing any calculations, and running with a fixed height, but that didn’t seem to work either (there’s some other mystic voodoo at play!
).
Any ideas (use the stock-standard Dawn theme for reference as I haven’t made any useful changes to either the component-slideshow.css or slideshow.liquid files.
Thanks in advance.
Hey ,
Yeah, Dawn’s slideshow section is built to cover the container by default (background-size: cover logic), which is why you’re seeing the top/bottom crop. If you’d rather keep the full image visible at a fixed height, you can override that with a couple of changes.
Try this approach:
- Open
component-slideshow.css and look for the .slideshow__media class. By default it uses object-fit: cover. That’s the culprit. Change it to:
.slideshow__media img {
object-fit: contain;
height: 500px; /* or whatever fixed height you want */
width: auto;
margin: 0 auto;
}
- Adjust the container so it doesn’t force the image to stretch full-width. In the same CSS file, tweak the
.slideshow__slide to align items center:
.slideshow__slide {
display: flex;
justify-content: center;
align-items: center;
}
- If you want it truly locked to a fixed height across all screen sizes, set the
max-height instead of height, so small screens don’t get huge blank bars:
.slideshow__media img {
object-fit: contain;
max-height: 500px;
width: auto;
}
That way the width scales down proportionally, no cropping, no weird voodoo.
One caveat: if your images have wildly different aspect ratios, you’ll end up with some white/empty space around them. That’s just the trade-off when you don’t crop.
Hi there,
You’re right — by default Dawn’s slideshow is set to use a “cover” style background, which always fills the container but crops either the top/bottom or sides. Unfortunately, Dawn doesn’t ship with a built-in “contain” option (scale-to-fit, no cropping).
Here are two approaches you can try:
1. Adjust via CSS (quickest fix)
In your component-slideshow.css, look for the .slideshow__media (or similar depending on your Dawn version) and override it with something like this:
.slideshow__media img {
object-fit: contain !important;
height: 500px; /* set your fixed height */
width: 100%;
background-color: #fff; /* optional, fills gaps with a color */
}
-
object-fit: contain; ensures the full image is shown without cropping.
-
Setting a fixed height gives you a consistent section size.
-
You’ll see “letterboxing” (blank space on sides/top), but that’s unavoidable if you don’t want cropping.
2. Liquid-based dimension handling (more control)
Dawn does expose image dimensions through Liquid filters like image.width and image.height. In slideshow.liquid you’ll often see markup like:
{{ slide.image | image_url: width: 2000 | image_tag }}
You can adjust this to include both width and height:
{{ slide.image | image_url: width: 2000, height: 500, crop: "fit" | image_tag }}
The key is replacing "crop: fill" with "crop: fit". That tells Shopify to scale the image inside the given dimensions rather than cropping it.
Which to choose?
If you’d like, I can drop in the exact override code for Dawn v12 (the latest release) so you can just paste it in without hunting through the theme files.