10. Sizing & Constraints

The Basics of Vev - Lesson 10.mp4

In this lesson, we’re going to take a look at the sizing and placement options for the components on your canvas, also know as constraints.

  • Sizing

  • Constraints


Sizing

In Vev, when it comes to adding elements to your canvas, there are various sizing options available. When adding an element to your canvas, you are free to adjust the size by clicking and dragging the handles on the outside corners of that object. The default value for a lot of elements will be percentage width and a pixel height.

With an element selected. You can change the sizing value by clicking the dropdown besides one of the size fields within the style panel, this will reveal a list of options. Here, you can define and control the size of elements using the following CSS units:

  • Pixels (px): A fixed or absolute value and are used when you need to specify an exact size.

  • Percentages (%): A relative value meaning their size is defined by a percentage of the parent container.

  • Viewport size (vw & vh): are sizes represent a percentage of the viewport's width and height. In Vev, the viewport is essentially the same size as the canvas which refers to the dimensions of the visible area within a web browser. For example, if the browser viewport width is 1000px then 1vw = 10px.

  • Automatic size (auto): Automatic size is used when you want the container to set the size automatically according to its content. For example, if you set a text container to be auto height, the height of the container will grow or shrink to contain the text when you add or remove content.

CSS units determine how an element is resized based on various factors, such as the screen size or the component's content. Based on the options I’ve mentioned, choose the one that best suits your sizing needs. Feel free to experiment with a variety of different sizing units to get a feel of how each works.

Locking Aspect Ratio

You can also lock the aspect ratio of an element, such as an image or video. This will allow you to adjust and resize the element but still maintain the overall relationship between height and width. To do this go to the chain symbol beside the width and height properties within the style panel. Selecting this option will lock the aspect ratio to the currently set ratio. Alternatively, you can right-click this icon to reveal a list of popular aspect ratios.


Constraints

Constraints refers to an object's position in relation to it’s parent container, such as a frame or the section itself. Essentially, it establishes a fixed anchor position in relation to the parent container.

When placing an element into a section or within a frame, constraints are automatically set according to the element's initial position. If you move the element, the constraints update automatically. This feature makes layout design easier by automatically setting the most suitable constraint for you. The auto constraint feature only apples to the X axis. The Y axis will always be set to “top” by default and will require changing manually when required.

With an element selected, these settings are visible at the top of the style panel on the right side of the canvas. Adjustments to constraints can be made either by directly interacting with the element or by altering the values of the elements in the style panel. If you want manual control over an element's constraint, you can turn auto constraints off by overriding the auto option here to be either left, centre or right.

Just like sizing a component, you are able to change the unit of constraints to: Pixels, Percentages, Viewport Width or Viewport Height.

Last thing to note, is that when working with constraints, you will see a blue guidelines on the canvas to highlight which constraint points are set based on the parent container (frame or section).


→ Next up, let’s explore: Adding a Section