I’m having trouble with a design I exported from Figma. The image is 1920x720 pixels, which is too big for my viewport. I have to scroll sideways to see the whole thing. This is frustrating!
Mike, I’ve encountered similar issues when working with Figma exports. One approach that’s worked well for me is using a combination of ‘object-fit’ and ‘object-position’ CSS properties. Try this on your image:
This should make the image cover the entire viewport while maintaining its aspect ratio. It might crop some edges, but it’ll prevent scrolling issues.
For overall responsiveness, consider using CSS Grid or Flexbox for your layout. These modern layout systems can help elements adjust more fluidly to different screen sizes. Also, don’t forget to use media queries to fine-tune layouts for specific breakpoints.
Lastly, ensure you’re using a responsive meta viewport tag in your HTML head: