GithubHelp home page GithubHelp logo

Comments (2)

waldyrious avatar waldyrious commented on May 19, 2024

After some testing, I'm thinking of using on this:

html { font-size: 1rem; }
@media (min-width: 37.5rem) { html { font-size: calc(0.4vw + .85rem) } }

or the equivalent in pixels:

html { font-size: 16px; }
@media (min-width: 600px) { html { font-size: calc(0.4vw + 13.6px) } }

The vw-based font-size provides a growth line with a reasonable slope related to the available viewport width -- i.e., if the font size is 16px at 600px of width, it will steadily grow until it's about 21px at 1920px (width of a 1080p screen).

The min-width rule provides constant font size of 16px as a minimum, for all viewports up to 600px, and from then the linear progression kicks in. For a smooth transition at the 600px mark, we need to shift the 0.4vw-sloped line up to pass 16px (y coord) at that width (x coord). Since the height of 0.4vw (remember, vw = x/100) is 2.4px at x=600px, we need to add 13.6px to reach 16px.

Perhaps I could set a smaller minimum, say 0.9rem.

And I wonder if we could get a smooth transition rather than a hard break. But using only elementary arithmetic operations it may become excessively convoluted.

from downstyler.

waldyrious avatar waldyrious commented on May 19, 2024

For future reference, cross-linking to another issue related to text sizing: #30

from downstyler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.