Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:14:48+00:00 2026-06-07T10:14:48+00:00

I need a scalable HTML5 website design. My idea is to define a base

  • 0

I need a scalable HTML5 website design. My idea is to define a “base” font-size of 1px in the body element and define all child elements relatively to this value in “em”.

More precisely: All sizes (width, height, margin, padding and font-size) of the child elements (images, divs etc.) are defined in “em” units, so it is easy to scale the whole website only by changing the “base” font-size (in the body).

I need to do this since different mobile devices have different screen sizes and also different devicePixelRatio values.

So, if I detect a bigger screen size (e.g. 1.2x bigger) via JavaScript, I can simply set font-size: 1.2px just for the body element and the whole website should be 1.2x bigger.

Example:

<!doctype html>
<html>

    <head>
        <title>foo</title>

        <style>
            body{
                font-size: 1px;
                /* If a sceen is 1.2x bigger than this "default" size, then change font-size to 1.2px */
            }

            #myimg{
                /* 200em = 200px in this case because body font-size=1px */
                width: 200em;
                height: 200em;
            }

            #somediv{
                width: 100em;
                height: 100em;
                font-size: 20em;
            }
        </style>
    </head>

    <body>
        <div id="wrapper">
            <img id="myimg" src="foo.jpg">
            <div id="somediv">
                foo
            </div>
        </div>
    </body>

</html>

The only problem is that containers that have a font-size (e.g. 22em) defined, also define a new “base” font-size for their child elements, so this must be avoided.

Example style (Must not happen!)

#wrapper{
  font-size: 3px;
}

If this style above would have been added, all child containers (and their children) would become 3 times bigger (=not what I want).

Is this whole idea a practicable solution, or are there better ways to create a fully scalable design?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:14:50+00:00Added an answer on June 7, 2026 at 10:14 am

    I tried my solution described and it worked very well.
    I also noted that this seems to be a pretty common practice.

    The only thing that I recommend to change is to use a base font size of 10px (instead of 1px) and divide all child element by 10.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to design a translation mechanism/strategy for the static text in my (scalable)
I need to develop a fairly scalable socket server for an HTML5 / Mobile
oh wise list, We need a scalable solution that can handle many concurrent requests
I am in need of a scalable and performant HTTP application/server that will be
I need some opinions on using PHP to make completely scalable websites.. For instance,
What options exist for creating a scalable, full text search with results that need
I am working on a website for movie reviews. In the current design, the
I am building a scalable Server Side App in Java but I need to
I need to make a design decision about database. The requirment is that one
I need a scalable NoSql solution to store data as arrays for many fields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.