Is the width property relative or absolute?

Hi,

In the design phase there are the option of relative or absolute size
image

I want to customise the same settings using blocks, however, how do I know which properties these are? For example the 100 and 20 here, are these ,relative or absolute, px or %?
image

It seems like margin and padding cannot be customised in blocks
image
image

2 Likes

Hi there,

It’s absolute size (in pixels) that is set when you set the size using blocks.

@jane ok ty, can this be adjusted to relative?

1 Like

You can do the calculations yourself Terry, relative to the width of the Screen.

i.e 25% is from Screen1 get width / 4

Hope that helps!

1 Like

@domhnallohanlon my question is how do you use “relative” as % rather than “absolute” as px, seems like that was not defined

Tried putting 1/4 in the math blocks, however, it always resolve to 1. The percentage cannot be entered either.
image

1 Like

Yes, but it has to be “relative” to something else. In my example above I outlined how to set the width of a component to 25%, relative to the width of the Screen. i.e Screen width / 4

1 Like

@domhnallohanlon oh I see, it seems like the drop down doesn’t have “width” option though?

1 Like

Hah! Well, that’s inconvenient :joy:

Turns out you can just use strings for relative sizing like this:

23

1 Like

@domhnallohanlon ohhh that’s cool, use string rather than integer, thanks for the help!

2 Likes