Skip to main content
Solved

Height auto for image at components

  • October 5, 2022
  • 3 replies
  • 1101 views

Stefan

I often run into the problem that I would like to have the following properties for an image in a component:

width: 100%
height: auto

This would be good if images have different aspect ratios to be able to place them anyway. Currently I can’t make a component out of it, because I can only replace the fill here and then the height always remains the same as defined in the component.

Best answer by dvaliao

Hey @Stefan,

It sounds like you’re wanting to use Scale/Scale constraints for your image within your frame, before creating a component out of it.

View original
This topic has been closed for comments

Stefan
  • November 6, 2023

This is probably a common scenario, isn’t it? How do you solve the problem?


dvaliao
Figmate
  • Community Support
  • November 7, 2023

Hey @Stefan,

It sounds like you’re wanting to use Scale/Scale constraints for your image within your frame, before creating a component out of it.


Stefan
  • November 9, 2023

Thanks for your reply! Not sure if this helps if I wound width: 100% height: auto scenario within my component? So height of image jumps depending on native image height.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings