How to Resize Container and Sub-Layers Together
Learn how the sub-layers’ position or size can be changed together with the container.
![Leah Han](https://cdn.sanity.io/images/qyzm5ged/production/67cb2146165aff6e7f1552fc6bb891445f745d51-120x120.png/Leah-ProtoPie-Teacher.png)
![How to Resize Container and Sub-Layers Together? thumbnail](https://cdn.sanity.io/images/qyzm5ged/production/e10c2f14b4137b6b7fc1a9678a8c06068f5257fc-2138x1200.jpg/How-to-resize-container-and-sub-layers-together-thumbnail.jpg)
Hi! Here is ProtoPie Teacher, Leah.
Did you know in ProtoPie there is a feature named Constraints? With it, you can define whether the sub-layers’ position or size should be changed together with the container.
![Changing Sub-layer's position and size gif](https://cdn.sanity.io/images/qyzm5ged/production/7bdc4349e2566af9ff6361e409395b7098c772d8-466x370.gif/1.gif)
Step 1: Define how the sub-layer will change following the container.
In your container, there might be several sub-layers, such as background and text layers. First, you should decide when you change the Container’s size, how the sub-layers will change.
![Sub-layer and Container](https://cdn.sanity.io/images/qyzm5ged/production/8a71448a5a8df0c310fe6da39a3312b925e16c90-640x512.png/image.png)
In this case, we want the background sub-layer to be scaled following the Container’s size.
It means that the distance from the border of the background sub-layer to the Container should always be the same. However, the text layer will not be changed following the Container’s size.
Step 2: Select sub-layer and set the constraints
The most important point is that you should set the constraints of the sub-layer, not container.
After you select the sub-layer, you can find the setting of the constraints on the property panel. If you want to change the sub-layer size with the container together, you should check the box (image below).
![Checkbox image](https://cdn.sanity.io/images/qyzm5ged/production/fd897d24b81f9ca01666bb54417e4db568b75ce8-152x160.png/image.png)
However, if you don’t want to change the size of the sub-layer (in this example, text layer), we just need to check the “fixed width” and “fixed Height” setting.
![Check the Fixed Width and Fixed Height setting](https://cdn.sanity.io/images/qyzm5ged/production/aec60219797dd8e0291413bc9200d2b030d79c09-640x512.png/image.png)
![Constraints feature demo gif](https://cdn.sanity.io/images/qyzm5ged/production/f3ed2399e8b73fddfc892aa84a0b38dc2cf2c6a3-800x591.gif/5.gif)
That’s all for now!
If there are some other tips that you would like to see us talking about, feel free to let us know by replying.