Object or Layouts position in "%" and not in "px"

How can I change the position of an object or layer with percentage “%” and not with “px”?

Example in code:

style=“position: absolute; left: 50%; width: 50%; height: 100%”;

In Hype how?


Percentage of what width and height? If you place that code within the inner HTML of an element, it will do what you want based on that element’s width, height, and position. If you’re trying to create a layout element which you’d like to adapt to the size of the window, you can use a rectangle, and use flexible layout settings.

OK, but if I need four rectangles, with a width of 25% of the window and each separated by a 25% margin on the left (0%, 25%, 50%, and 75% of the window) how can I do it?

As a suggestion, you can add the option position in measures of “%”, since only you can do in “px”.

Thanks for the suggestion.

For now, elements in Hype must be measured in pixels, but you can set up relationships between that size and the width of your document using flexible layouts.

test.zip (11.9 KB)

Thanks Daniel!.