The Best Sizes For Your Website | Site Width | Padding | Fonts Sizes

  • 8 min
The Best Sizes For Your Website | Site Width | Padding | Fonts Sizes Plays from YouTube

A free, step-by-step tutorial by Ferdy. Watch it right here or on YouTube.

In order to keep your website responsive and accessible for your viewers, it is better not to use pixels for your font size. In order to make everything easier for you, I decided to give you the best practises when it comes to site width, padding, and font sizes.

H1 (52px → 34px)

clamp(2.1rem, 1.6rem + 2.2vw, 3.25rem)
Line-height: 1.1

H2 (42px → 29px)

clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem)
Line-height: 1.15

H3 (34px → 24px)

clamp(1.5rem, 1.2rem + 1.1vw, 2.1rem)
Line-height: 1.2

H4 (26px → 24px)

clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem)
Line-height: 1.25

H5 (21px → 18px)

clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem)
Line-height: 1.3

H6 (18px → 16px)

clamp(1rem, 0.98rem + 0.2vw, 1.125rem)
Line-height: 1.35

Body

clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
Line-height: 1.8

Related: Learn more about WordPress

The best font sizes for your website: rem and clamp

Most people set their font sizes in pixels. It works, but it is not the best choice. In this guide I explain why I use rem and clamp for headings and body text, and how I set them up in Elementor. When you are done, your text scales on every screen size and respects the settings of visitors who need bigger text.

You do not need to calculate anything yourself. The clamp values and line heights for H1 to H6 and the body text are at the top of this page. You only need to copy and paste them.

Why pixels are not ideal for fonts

To show you the difference, I placed two H1 headings below each other in Elementor. In a real page you should only have one H1, because that tells Google what the most important title of the page is. This is just a test.

  1. The first heading gets a size of 64 pixels.
  2. For the second heading, go to Style, then Typography, and change the unit from px to rem.
  3. By default, 1 rem is 16 pixels. So 2 rem is 32 pixels, and 4 rem is 64 pixels. Set it to 4 rem.

Now both headings look exactly the same. So what is the difference? Open the settings of your browser. In Chrome, go to Appearance and change the font size to Very large. This is what someone does when they have a hard time reading small text, for example a grandmother who wants bigger letters on her screen.

The heading in pixels stays exactly 64 pixels. It ignores her setting. The heading in rem grows to 96 pixels. It follows the choice of the visitor, and that is what we want. That is why rem is better for accessibility.

Do not forget to set your browser font size back to Medium after the test.

What clamp does for responsive text

There is an even better way: rem in combination with clamp. A clamp value decides for itself how much the font should shrink, based on the width of the browser, tablet or phone. It has a minimum size, a preferred size that moves with the screen width, and a maximum size.

The code looks a bit complicated, so I made the values for you. For example, the H1 clamp is 52 pixels on a big screen and becomes smaller on a phone. The size for each heading level is written next to it at the top of this page.

To test it in Elementor:

  1. Copy the clamp code for H1 from the top of this page.
  2. In Elementor, open Typography for the heading and change the unit to Custom.
  3. Paste the clamp code.
  4. Set the pixel heading to 52 pixels so both start at the same size.
  5. Make the browser window narrower.

The pixel heading stays the same size. The clamp heading becomes smaller as the screen gets narrower. This means you no longer have to adjust every heading and text block for tablet and mobile by hand. Clamp does it all at once.

Set the clamp values for all headings in Elementor

Changing every heading by hand would take forever. So I set the values once in the global settings, and every heading on the website uses them.

  1. In Elementor, open Site Settings and go to Typography.
  2. Open H1, set the size unit to custom and paste the H1 clamp code.
  3. Set the line height unit to em and use the value from the list. For H1 that is 1.1. I first typed 1.2 and it was too much space.
  4. Do the same for H2 with its clamp code and a line height of 1.15.
  5. Repeat this for H3, H4, H5 and H6.
  6. Click Save changes.

Set the body text and global fonts

Headings are only half of the work. Your body text is what people read the most, so it needs to be comfortable to read.

  1. In Site Settings, Typography, open Body.
  2. Set the size to 1 rem.
  3. Set the line height to 1.6 em. With a bit more space between the lines, long text is easier to read.
  4. Go to Global Fonts and do the same for Primary, Secondary, Text and Accent: 1 rem with a line height of 1.6 em.
  5. Save the changes.

Watch the units. The font size is in rem and the line height is in em. It is easy to mix them up. I did it myself, and I told my viewers I was checking whether they were paying attention.

Tip: to see the effect, paste a long piece of text into a text editor widget. It is much easier to judge the line height on a full paragraph than on a single line.

The clamp code for body text at the top of this page is a step further: it also lets the body text scale slightly with the screen. That page also lists a line height of 1.8 for body text, so you can choose between a slightly tighter or a more open look.

Where to go next

With these settings, your typography is optimized for all devices and you save yourself a lot of time. In the next part of this series I talk about the new Elementor Atomic Editor and classes. If you are new to Elementor, start with my Elementor tutorial for beginners. If you want to build a complete website, follow my newest WordPress tutorial. You can also look up terms like rem and em in the knowledge base.

Frequently asked questions

What is the difference between px and rem?

Pixels are a fixed size. Rem is relative to the base font size of the browser, which is 16 pixels by default. If a visitor sets a bigger font size in their browser, text in rem grows with it and text in pixels does not.

What does clamp do in CSS?

Clamp sets a minimum size, a preferred size and a maximum size. The font scales between the minimum and maximum based on the width of the screen, so you do not need separate sizes for tablet and mobile.

How do I use clamp in Elementor?

In the typography settings, click the size unit and choose Custom. Then paste the clamp code. Do this in Site Settings, Typography, so it applies to the whole website.

How many H1 headings should a page have?

Only one. The H1 tells Google what the most important title of the page is.

36 thoughts on “The Best Sizes For Your Website | Site Width | Padding | Fonts Sizes”

  1. Dag Ferdy.
    zeer interessante tutorial die ik met aandacht volg. Nav de rem instellingen heb ik een vraag, of eigenlijk twee:
    – klopt het dat je voor laptop, tablet en mobiel de waarden afzonderlijk moet invoegen?
    – betekent dit rem principe ook dat je een H1 titel niet meer handmatig hoeft te verkleinen indien deze op je mobiel te groot is, en dat dit automatisch wordt aangepast?

    hoop dat je de tijd vind om hier een antwoord op te geven.

    1. Hoi Martin! Goede vragen ???? Met clamp() stel je de waarden één keer in – je hoeft inderdaad geen aparte waarden in te voeren voor laptop, tablet en mobiel. Clamp() regelt dat automatisch. En ja, een H1 die te groot is op mobiel wordt automatisch kleiner als je clamp() correct instelt via de globale typografie. Geen handmatige aanpassingen meer nodig! ????

    2. Hoi Martin! Goede vragen ???? Met clamp() stel je de waarden één keer in – je hoeft geen aparte waarden in te voeren voor laptop, tablet en mobiel. En ja, een H1 die te groot is op mobiel wordt automatisch kleiner. Geen handmatige aanpassingen meer nodig! ????

  2. Martin de Graaff says:

    Dag Ferdy,
    denk dat ik iets langer had moeten kijken naar je video. Het werd nog uitgelegd…… LOL

    Maar wel en andere vraag: ik werk nu nog met EP #3+. Ook daar kan ik rem gebruiken. heeft dat hetzelfde effect als in versie 4?
    vr groet Martin

    1. Ha, geen zorgen Martin! ???? Rem werkt prima in Elementor – je kunt de waarden handmatig invoeren in px of rem. Clamp() als CSS-functie werkt ook in Elementor maar moet je dan via custom CSS toevoegen. In Divi 5 is dat ingebouwd in de interface. Succes ermee!

    2. Ha, geen zorgen Martin! ???? Rem werkt prima in Elementor – je kunt de waarden handmatig invoeren. Clamp() als CSS-functie werkt ook, maar moet je via custom CSS toevoegen. In Divi 5 is dat ingebouwd in de interface. Succes ermee!

  3. I’m currently learning Elementor because I’m planning to change my theme soon, and this guide came at the perfect time.
    Thanks for sharing such useful insights.

    1. Perfect timing indeed! ???? Good luck with the theme switch – Elementor is a great choice. Hope the tutorial helps you get set up smoothly!

    1. Graag gedaan Jos! Ja, het is echt een tijdsbesparing zodra je er eenmaal gewend aan bent. Veel succes met al je websites! ????

  4. Paul Huybrechts says:

    Hoi Ferdey
    Intersante en goede uitleg. Ik heb er althans veel van bijgeleerd als recente divi gebruiker.
    Wat er wel mis is gegaan en ik ben daar achter gekomen is dat je de waarden van H3 en H4 hebt geschreven met een komma ertussen, dat moet een punt zijn anders neemt Divi de waarde niet aan.

    Nog vele groeten en ik kijk al uit naar de volgende video’s

    1. Ha, goed gevangen Paul! Je hebt helemaal gelijk – bij CSS-waarden moet een punt gebruikt worden als decimaalteken, geen komma. Bedankt voor het delen, dat helpt zeker andere kijkers! ???? Groetjes!

    2. Ha, goed gevangen Paul! Je hebt helemaal gelijk – bij CSS-waarden moet een punt als decimaalteken, geen komma. Bedankt voor het delen, dat helpt zeker andere kijkers! ???? Groetjes!

  5. Jenny Setchell says:

    Loving your tutorials Ferdy – you’re the best!. But can you tell me what the font is that you are using for the body text here?

    1. Thanks Jenny! ???? The body font I use is Inter – clean, modern, and very readable. You can grab it for free on Google Fonts. Hope that helps!

    2. Thanks Jenny! The body font I use is Inter – clean, modern and very readable. You can grab it free on Google Fonts. Hope that helps!

  6. Hi,
    Just going through your Divi 5 tutorial. Really good stuff for someone who is wanting to make the jump from Divi 4.
    I have always used clamp but in a different way and found a complicated method (that works) using calc to determine the middle sizing value.
    Yours looks to be a much simpler version. How do you calculate the middle value?
    Also does this work for all devices or do you need to add H1, H2, etc variables for mobiles and tablets?
    Many thanks

    1. Great questions, Neil! For the middle value in clamp() I use a viewport-relative value like 3vw – it scales smoothly between the min and max. And the beauty of clamp() is that it adapts automatically to every screen size, so you don’t need separate values for desktop, tablet, or mobile. Set it once and it just works! ????

    2. Great questions, Neil! For the middle value in clamp() I use a viewport-relative value like 3vw – it scales smoothly between min and max. And the beauty of clamp() is that it adapts automatically to every screen size, so no separate values needed for desktop, tablet, or mobile. Set it once and it just works! ????

  7. Thank you to share your knowledge and advise. Apreciate your effort and time dedicated to teach. Currently I am developing my website and I will show you the results as soon as I finish . Thank you again.

    1. That’s so nice to hear! I love seeing people take action. Can’t wait to see what you build – feel free to share when it’s ready! ????

  8. Ferdy, you make tutorials very simple and highly useful. Keep it it up. I would like to get in touch if you don’t mind reaching out.

  9. Hi Ferdy, thank you so much for your tutorials; I really appreciate them!

    I do like to ask first; is it okay to copy and paste information, like the recommended font sizes to sites I use?

    Thank you.

  10. Great question James! Yes – in Elementor, go to your widget, find the Typography section, and the font size field supports clamp() if you type it directly. Or use Elementor Pro’s built-in responsive sizing options under the font settings. Clamp() gives you the most control with just one value across all screen sizes! ????

  11. Haha, sorry Sander! ???? Die clamp() functie klinkt ingewikkelder dan het is. Maar zodra je het eenmaal begrijpt is het een van die dingen die je altijd wil gebruiken. Fijn dat je de video goed vond!

  12. You’re welcome, Michelle! ???? Glad it clicked! Typography makes such a huge difference in professional-looking websites.

Leave your comment

Your email address will not be published. Required fields are marked *

Never miss
a tutorial

Every tutorial lives on YouTube. Subscribe and never miss a new one.

Black Friday A full year of Hostinger web hosting + free domain for about $30 with coupon code FERDY1 year hosting + free domain: about $30 with code FERDY Ends Dec 14 Get the deal Ad