Skip to main content
Solved

Height auto for image at components

  • October 5, 2022
  • 3 replies
  • 1168 views

Stefan
  • New Participant
  • 10 replies

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 djv

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 replies.

3 replies

Stefan
  • Author
  • New Participant
  • 10 replies
  • November 6, 2023

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


djv
Figmate
  • Community Support
  • 4798 replies
  • Answer
  • 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
  • Author
  • New Participant
  • 10 replies
  • 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