Skip to main content
Solved

Height or Width of an Element equal to another


Hello, can I make the height of my rectangle equal to that of another rectangle? like always the same size?

Best answer by Haroll

Hi @Albraa_Alsakor

1 - Variable

  1. Create a number variable (for example rect_height) and assign it a value (240px)
  2. Create your two rectangle
  3. Assign the previously defined variable to both
  4. Now, both your rectangle have the same height (if you want to change its value, you’ll need to do it from the variable panel)

2 - Auto-layout method

Disclaimer: For this two work, your rectangle has to be part of the same frame

You can use the Auto-layout feature to do so.

  1. Create the first rectangle with the given height
  2. Wrap it in a auto-layout frame (click on your rectangle and do Shift+A)
  3. set the height of the auto-layout to Hug
  4. Add you second rectangle into the auto-layout frame and set its height to Fill
    You can now change the height of your first rectangle and you will see that the second one will adapt

Hope it helped

View original
This topic has been closed for comments

Haroll
  • Active Member
  • August 8, 2023

Hi @Albraa_Alsakor

1 - Variable

  1. Create a number variable (for example rect_height) and assign it a value (240px)
  2. Create your two rectangle
  3. Assign the previously defined variable to both
  4. Now, both your rectangle have the same height (if you want to change its value, you’ll need to do it from the variable panel)

2 - Auto-layout method

Disclaimer: For this two work, your rectangle has to be part of the same frame

You can use the Auto-layout feature to do so.

  1. Create the first rectangle with the given height
  2. Wrap it in a auto-layout frame (click on your rectangle and do Shift+A)
  3. set the height of the auto-layout to Hug
  4. Add you second rectangle into the auto-layout frame and set its height to Fill
    You can now change the height of your first rectangle and you will see that the second one will adapt

Hope it helped


  • August 17, 2023

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.


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