What is the difference between PX, EM, REM,%, VW and VH?

> Introduction to Elementor

Basic structure of an HTML document

As Carl Sagan said, “If you want to make an apple pie from scratch, you have to invent the universe first.”And yes, in order to understand relative units of Elementor, what is a parent element or the root container, etc., we first need to know how a web page is basically structured in HTML language.

Here we see the minimal structure of an HTML (Hypertext Markup Language) document, the HTML language is composed of tags that are delimited by the lesser signs that are used in the HTML document. < and greater than >example <html>with exceptions such as the first label <!DOCTYPE html> which is absolute, all tags have opening and closing, e.g. <h1>Header</h1>, the closing is distinguished because the opening of the tag includes </ in addition to the “less than” slash also called slash /.

Minimum structure of an HTML document
  1. The first line of the example is an absolute element (it has no closing tag); it is a document type declaration (also called DOCTYPE statement ) that identifies this document as an HTML5 document and lets modern browsers know that they must interpret the document as written in accordance with the HTML5 specification.
  2. The entire document is contained within an html document. The html is called root element because it contains all the elements of the document and cannot be included in any other element.
  3. Within html, the document is divided into a head and a body. The head contains descriptive information about the document itself, such as its title, the style sheets it uses, scripts and other types of “meta” information.
  4. The body is the body of the page, it is the element that contains everything we want to appear in the browser window.
  5. The meta elements within the head tag provide information about the document itself. A meta element can be used to provide all kinds of information, but in the case of this example it specifies the character encoding (the standardized collection of letters, numbers and symbols) used in the document.
  6. Inside the head there is also the mandatory title tag. According to the HTML specification, each document must contain a descriptive title. It is this title that is displayed in the browser tab and that Google will show in the search listing as the title of this page.
  7. Within the body block we can create as many sections as we want, the div tag, this tag allows us to group several block elements (paragraphs, headings, lists, etc). These sections are containers.
  8. It is another section like the previous one.

As you can see in the Figure, all these tags are like a kind of containers, the root or main tag is the html tag that contains all the others, inside html we have the body, and in turn inside the body we have other div. So we can say that the root element is html, body is a child of html and divs are children of body.

Elementor units of measure

When designing with Elementor, you can see that some elements have sizing options, allowing you to choose PX, EM, REM,%, VW or VH. But what do these units of measurement really mean and when should you use one or the other?

Let’s start with the basics, in CSS, you can specify sizes or lengths of elements using various units of measurement. The units of measurement you will find in some Elementor widget options include PX, EM, REM, %, VW and VH, although there are several more available in CSS. Not all Elementor elements will offer all of these units. Elementor only presents the options that make the most sense for the given element.

The most important aspect to learn about the different units is that some units, such as PX, are absolute units and others are relative units.

Absolute units

PX: pixels (px) are considered absolute units, although they are relative to the DPI and resolution of the display device. But in the device itself, the PX unit is fixed and does not change depending on any other element. The use of PX can be problematic for responsive websites, but they are useful for maintaining a consistent size for some elements. If you have elements that should not be resized, then using PX is a good option.

Relative units

  • EM: relative to the parent element
  • REM: relative to the root element (HTML tag and, failing that, the size configured by the browser).
  • %: relative to the parent element
  • VW: relative to the graphic window width
  • VH: relative to the height of the graphics window

Unlike PX, relative units such as %, EM and REM are better suited to responsive design and also help to comply with accessibility standards. Relative units scale better on different devices because they can scale up and down according to the size of another element.

Let’s look at a simple example, in most browsers, the default font size is 16px. Relative units calculate the size from this base. If you change that base by setting a base size for the HTML tag through CSS, that becomes the basis for calculating the relative units on the rest of the page. Similarly, if a user adjusts their font size, that becomes the basis for calculating relative units.

So what do these units mean when it comes to the default value of 16px?

The number you specify will multiply that number by the default size.

1em = 16px (1 * 16)

2em = 32 px (2 * 16)

0.5em = 8px (.5 * 16)


1rem = 16 px

2rem = 32px

0.5rem = 8px


100% = 16 px

200% = 32 px

50% = 8 px


Okay, great, but what if the user changes the default size in their browser? Because these are relative units, the final size values will be based on the new base size. Although the browser default is usually 16px, if the user were to change it to 14px, the calculated sizes would end up being:


1em = 14px (1 * 14)

2em = 28px (2 * 14)

0.5em = 7px (.5 * 14)


1rem = 14px

2rem = 28px

0.5rem = 7px


100% = 14 px

200% = 28 px

50% = 7px


This gives the user the freedom to adjust the default font size of their browser, while maintaining the relative scale of each element they have specified.

What is the difference between MS and REM?

Looking at the graph above, it shows EM and REM looking exactly the same. So how do they differ?

In short, they differ according to heredity. As mentioned, REM is based on the root element (HTML) and in its default if it is not set to the user’s browser, which defaults to 16px. Each child element using REM will use the HTML root size as the calculation point, regardless of whether or not a parent element has different sizes specified.

EM, on the other hand, is based on the font size of the main element. If a main element has a different size than the root element, the EM calculation will be based on the main element and not on the root element. This means that nested elements that use EM for sizing can sometimes end up having a size that you did not anticipate. On the other hand, it gives you more detailed control if you need to specify the size of a particular area of a page.

So what about %, VW and VH? What are they about?

While PX, EM and REM are mainly used for font size, %, VW and VH are mainly used for margins, padding, spacing and widths/heights.

To reiterate, VH stands for “viewport height”, which is the height of the visible screen. 100VH would represent 100% of the viewport height or the full height of the screen. And, of course, VW stands for “viewport width”, which is the width of the visible screen. 100VW would represent 100% of the width of the graphic window or the full width of the screen. % reflects a percentage of the size of the main element, regardless of the size of the graphic window.

Let’s look at some examples of where Elementor offers %, VW and VH options.

  • Column widths: if you edit the layout of an Elementor column, you will notice that there is only one width size unit available: %. Column widths only work well and responsively when percentages are used, so no other options are offered.
  • Margins: the margins of a section can be specified in PX or %. Generally, it is preferable to use % to ensure that the margins are not larger than the content when scaling down for a mobile device, for example. By using a percentage of the device width, your margins will remain in relation to the size of the content, which is almost always preferable.
  • Padding: the padding of a section can be specified in PX, EM or %. As with margins, it is often preferable to use EM or % so that padding remains relative as page size increases.
  • Font size: if you edit the typography of an element, such as a header, you will see four options: PX, EM, REM and VH.

Have you ever created a large header and admired how great it looked on desktop, only to realize it was too big on mobile?

The key to solving this elegantly is to use EM, REM or VW instead of PX. What you choose depends on your particular situation. I usually choose EM because I want the size to be relative to the parent of the header. But if you prefer the size to be relative to the root size (HTML), choose REM instead. Or, you can set it to be relative to the width of the graphic window (VW) if that works better for your case.

Note that you can also set device-specific font size PX values by using the device icons to specify a size for desktop, tablet and mobile device. But that still imposes limits on responsiveness and accessibility, so keep that in mind if you choose PX.

More about VW and VH

The units of the graphic window represent a percentage of the current browser graphic window (current browser size). While similar to percentage units, there is a difference. The units of the graphic window are calculated as a percentage of the current size of the browser graphic window. Percentage units, on the other hand, are calculated as a percentage of the main element, which may be different from the size of the graphic window.

Let’s consider an example of a 480px x 800px moving screen display window.


1 VW = 1% of the width of the graphic window (or 4.8 px)

50 VW = 50% of the width of the graphic window (or 240 px)


1 VH = 1% of the height of the graphic window (or 8px)

50 VH = 50% of the height of the graphic window (or 400 px)


If the size of the graphic window changes, the size of the element changes respectively.

When should I use one unit over another?

Ultimately, there is no perfect answer to this question. In general, it is often better to choose one of the relative units rather than PX so that your website has the best chance of representing a responsive design. However, choose PX if you need to ensure that an element never changes size at any breakpoint and remains the same regardless of whether a user has chosen a different default size. PX units guarantee consistent results even if that is not ideal.

  • EM is relative to the font size of the parent element, so if you want to scale the size of the element based on the size of its parent use EM.
  • REM is relative to the font size of the root (HTML) and if this is not set, the one configured by the browser will be used, so if you want to scale the size of the element according to the size of the root, no matter what the main size is, use REM. If you have used EM and are encountering sizing problems due to many nested elements, REM is probably the best choice.
  • VW is useful for creating full-width (100%) elements that fill the entire width of the graphic window. Of course, you can use any percentage of the width of the graphic window to achieve other objectives, such as 50% for half the width, etc.
  • VH is useful for creating full-height (100%) elements that fill the entire height of the viewport. Of course, you can use any percentage of the height of the graphic window to achieve other goals, such as 50% for half the height, etc.
  • % is similar to VW and VH, but is not a length relative to the width or height of the graphic window. Instead, it is a percentage of the width or height of the parent element. Percentage units are often useful for setting margin widths, for example.
  • Elementor makes it easy to choose the option that best suits your design. Ultimately, it’s your choice.
Suscríbete a Elementor Academy

Subscribe and receive notices of new content

Related topics

Condiciones de visualización para plantillas globales del Maquetador de temas
Elementor display conditions
 true
0.0/5
Introduction to Elementor, Templates
Maquetador de temas de Elementor
Elementor theme designer
 true
0.0/5
Introduction to Elementor, Templates
Plantilla de Cabecera y Pie de página en Elementor
Header and Footer template in Elementor
 true
13:21
0.0/5
Introduction to Elementor, Templates
Configuración global con el Kit por defecto de Elementor
Elementor default kit
 true
08:00
0.0/5
Introduction to Elementor, Site settings
Ancla en Elementor enlaces a la propia página
Anchor in Elementor links to own page
 true
41:00
0.0/5
Advanced tab, Introduction to Elementor
Plantilla Global Elementor
Elementor global widget template
 true
07:00
0.0/5
Introduction to Elementor, Templates
Navigator de Elementor
Elementor Navigator
 true
08:56
0.0/5
Introduction to Elementor
Caja de Tipografía de los widgets de Elementor
Elementor Typography Box
 true
16:48
0.0/5
Introduction to Elementor
Colores globales, Fuentes globales y Estilos del tema en Elementor
Global Colors, Global Fonts and Theme Styles in Elementor
 true
10:31
0.0/5
Introduction to Elementor, Site settings
Cómo activar el modo oscuro o dark mode
How to activate dark mode
 true
01:20
0.0/5
Introduction to Elementor
{{ reviewsTotal }}{{ options.labels.singularReviewCountLabel }}
{{ reviewsTotal }}{{ options.labels.pluralReviewCountLabel }}
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}
Scroll to Top

Generate effective SEO texts with AI to rank your website on Google

Generating effective SEO texts is essential to position our website in Google. It is important to follow the rules and create original and interesting content, both in text and video, and to have branded profiles on social networks. We must also pay attention to the structure of the content and links, as well as the spelling quality. With keyword research, copywriting and optimization of the URL, title and meta description we can create a good SEO text. The generation of internal and external links and the analysis of results are also key to improve our strategy.

Importance of SEO positioning in Google

Positioning in Google is fundamental in any digital strategy. It is important to note that there are two different types of results: SEM results and SEO results, the latter generating an ROI of 20%.

SEM vs SEO Results

SEM results are those achieved through advertising on Google, while SEO results are those achieved by optimizing the website to appear in Google’s top search results.

20% ROI

The fact of achieving a 20% ROI thanks to SEO actions is an indicator that this strategy is very efficient compared to others.

Google standards and creativity in content creation

It is important to follow Google’s rules when creating content, however, we must not neglect creativity and originality in the creation of interesting and valuable content to improve our SEO.

Content creation for SEO

The creation of interesting and original content is key to improve the positioning of our website in Google. Here are some keys to creating effective content on different platforms.

Video content on YouTube and Instagram

Video content is becoming more and more relevant in SEO content strategy. YouTube and Instagram are two of the most widely used platforms for sharing branded videos, although each has its own particularities. It is important to take these differences into account and adapt the content according to our needs. On YouTube, for example, videos should be longer and more detailed, while on Instagram, shorter and more eye-catching videos can be used.

Brand profiles in social networks

Having a presence in social networks is essential to maintain a good SEO positioning strategy. These brand profiles must be consistent with the content of our website and be active with regular publications. In addition, it is important to use keywords in the biography and use attractive content to invite users to visit our website.

Content structure, internal links and spelling

Content structure is one of the most important elements when creating content for SEO. The title hierarchy from H1 to H4 must be taken into account and follow a logical order in the content structure. It is also essential to include both internal and external links to improve the navigation and authority of our website. Finally, we must not neglect the spelling and grammar of the content, as they can negatively affect the quality of our website and therefore harm the positioning in search engines.

Keys to good SEO copywriting

To achieve a good SEO positioning in Google and improve the traffic to our website, we must take into account certain keys in the writing of our contents. These include:

Keyword research

Before writing SEO copy it is important to do keyword research. We must choose those words that are related to our content and that have a high search volume but at the same time have low competition. This will help us to better position our content in search results.

Text structure and linkbuilding

The structure of the text is key in writing a good SEO text. We must structure it with H2, H3 and H4 subtitles and use internal links that redirect to other contents of our website and external links to other sources of information related to our sector. This will contribute to increase the authority of our website and improve our positioning.

URL, title and meta description writing and optimization

The wording of the URL, the title and the meta description of our content are also important factors in SEO positioning. We must create a simple and descriptive URL, a catchy title and a meta description that summarizes the content clearly and concisely. In addition, we must include in them our keywords in a natural and coherent way.

We should not be overly obsessed with optimization per se, but focus on creating valuable, interesting and compelling content for our audience. All this will help us to improve our SEO positioning in Google and to generate quality visits to our website.

Internal and external link generation and results analysis

The generation of internal and external links is essential to improve the SEO of our website. Internal links help to distribute the value of the pages of our website, which improves the SEO of all of them, while quality external links bring authority and relevance to our website, which helps it to rank better.

Analysis through tools such as Google Analytics and Search Console

To measure the success of our SEO strategy we must analyze the data obtained through tools such as Google Analytics and Search Console. These tools allow us to know the traffic of our website, its origin, the keywords used by users, the average duration of the visit, among other aspects. In this way, we can detect and correct possible errors that are affecting our position in Google. In addition to these tools, there are other advanced options that allow us to improve the efficiency of our SEO strategy. Some of them are Ahrefs, Moz or SEMrush, which offer detailed statistics on the performance of our page and allow us to know in depth the competition.

SEO content writing services

If you don’t have enough time or resources to create quality SEO content, there are SEO content writing services that can help. These services have teams of professionals who are responsible for creating SEO-optimized content that meets all standards and is attractive to users. In addition, these services can help you research keywords, generate links and optimize your URLs, titles and meta descriptions, among other things. With the help of these services, you can significantly improve the position of your website in Google and increase traffic and quality visits.

Tips to improve the SEO positioning of our website

To improve the SEO positioning of our website, it is important to follow certain tips to achieve greater success in Google:

Think SEO when writing texts

It is essential to keep keywords and SEO optimization techniques in mind when writing any type of content, never forget this.

Knowing our target audience

It is important to know our target audience in depth, to know their needs, their interests and their behavior, so we can create content that is attractive to them.

Image optimization

Images are an important factor in SEO positioning, as they can attract users and improve the duration of their visit on our website. It is necessary to optimize the images in terms of size and weight and choose appropriate file names with the keywords of our niche.

Quality design and content

We must take care of the design of our website so that it is attractive and easy to use for the user, so that they spend more time on it. In addition, the content must be interesting and relevant to have a chance of being shared on social networks.

This is a pop-up message

Elementor has a popup message builder that you can find in the Templates menu.

Plantillas > Mensajes emergentes

hello!

Enter your access data